I have a script to create folders in a trusted domain, the script will create the folders properly and get-acl information for the folders however i am unable to change the ace/alc
When i get-acl it returns the sids instead of the friendly names for the groups.
I am running the script from Forest A attempting to get/set-acl on resources in Forest B
What is have so far is
###########################################
#region Apply Access Controls to $ftpFolder
$aclFtpRoot = {Get-Acl -Path $($ftpFolder)}
if
($aclFtpRoot.AreAccessRulesProtected) { $aclFtpRoot.Access | % {$aclFtpRoot.purgeaccessrules($_.IdentityReference)} }
else
{
$isProtected = $true
$preserveInheritance = $false
$aclFtpRoot.SetAccessRuleProtection($isProtected, $preserveInheritance)}
$rule1 = New-Object System.Security.AccessControl.FileSystemAccessRule(“BUILTIN\Administrators”,“FullControl”,“ContainerInherit,ObjectInherit”,“None”,“Allow”)
$aclFtpRoot.AddAccessRule($rule1)
Set-Acl -aclobject $aclFtpRoot -Path $ftpFolder
$rule2 = New-Object System.Security.AccessControl.FileSystemAccessRule($filerDRwGroup,“FullControl”,“ContainerInherit,ObjectInherit”,“None”,“Allow”)
$aclFtpRoot.AddAccessRule($rule2)
Set-Acl -aclobject $aclFtpRoot -Path $ftpFolder
$rule3 = New-Object System.Security.AccessControl.FileSystemAccessRule($divisionListGroup,“ListDirectory”,“None”,“None”,“Allow”)
$aclFtpRoot.AddAccessRule($rule3)
Set-Acl -aclobject $aclFtpRoot -Path
$ftpFolder
#endregion
###########################################
If i perform
$ftpfolder = ‘\Filer\test.com’
$aclFtpRoot = Get-Acl -Path $ftpFolder
$aclFtpRoot | Select-Object -ExpandProperty access
It returns
FileSystemRights : FullControl
AccessControlType: Allow
IdentityReference:BUILTIN\Administrators
IsInherited:False
InheritanceFlags: ContainerInherit,ObjectInherit
PropagationFlags:None
FileSystemRights: ReadAndExecute, Synchronize
AccessControlType:Allow
IdentityReference:S-1-5-11-1111111111-1111111111-1111111111-1111
IsInherited:False
InheritanceFlags:ContainerInherit
PropagationFlags: None
If i would like to add the rule i get error
$aclFtpRoot.AddAccessRule($rule3)
Exception calling “AddAccessRule” with “1” argument(s): “Some or all identity references could not be translated.”
At line:1 char:1
-
$aclFtpRoot.AddAccessRule($rule3)
-
-
CategoryInfo : NotSpecified: (
, MethodInvocationException -
FullyQualifiedErrorId : IdentityNotMappedException
Thank you