Hi all,
I have a question regarding ACL-ing.
First let me scetch my “problem”
We are doing a data migration between 2 different domains.
While there is a 2 way transitive trust between them, this makes it a little easier.
Now my plan is to copy the data from the source domain, using Robocopy, to the target domain and leave the ACL from the source domain, while users will still be in the source domain when they access their data.
Now what I am looking for is 2 scripts :
- Reed ACL from the source and write the info to a csv file :
$OutFile = “C:\scripts\Sesogper.csv”
$Header = “Folder Path,IdentityReference,AccessControlType,IsInherited,InheritanceFlags,PropagationFlags”
Del $OutFile
Add-Content -Value $Header -Path $OutFile
$RootPath = “H:”
$Folders = dir $RootPath -recurse | where {$_.psiscontainer -eq $true}
foreach ($Folder in $Folders){
$ACLs = get-acl $Folder.fullname | ForEach-Object { $_.Access }
Foreach ($ACL in $ACLs){
$OutInfo = “`”" + $Folder.Fullname + “`”," + $ACL.IdentityReference + “,” + $ACL.AccessControlType + “,” + $ACL.IsInherited + “,” + $ACL.InheritanceFlags + “,” + $ACL.PropagationFlags
Add-Content -Value $OutInfo -Path $OutFile
}}
- Modify the .csv file by adding the new group and user names (they will be the same for users, but differ with groups) with the new domain name in front of it and use a PowerShell script to add the ACL to the Target location.
All system level ACL can be left behind, just focussing on the group and user settings.
Now for the second script I am having difficluties to find a proper script for that.
Can anyone here help me with this ?
Íf it’s easier to use icacls.exe in a script, please advise in how to.
Thanks in advance.
Regards, Ron