Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Exception calling "AddAccessRule" with "1" argument(s): "Some or all identity references could not be transla ted." error

$
0
0

Hi guys, Im trying to make a permission group, folder and set the permission to the folder, but it returns me this error :


Exception calling "AddAccessRule" with "1" argument(s): "Some or all identity references could not be transla
ted."

It drives me crazy

this is part of my code

###create AD group

new-QADGroup -proxy -Name $orgBasedResourceName -samAccountName $orgBasedResourceName -ParentContainer $targetOU -Description $desc -GroupScope  $targetGroup.GroupScope -GroupType $targetGroup.GroupType


###create folder

New-Item -ItemType directory -Path ($dir+$deptListCode)


###set the permission

$colRights = [System.Security.AccessControl.FileSystemRights]"Read, Write"

$InheritanceFlag = [System.Security.AccessControl.InheritanceFlags]::None
$PropagationFlag = [System.Security.AccessControl.PropagationFlags]::None

 $objType =[System.Security.AccessControl.AccessControlType]::Allow
                    
$objUser = "AMAIISDOM\"+$orgBasedResourceName
$objACE = New-Object System.Security.AccessControl.FileSystemAccessRule `
                        ($objUser, $colRights, $InheritanceFlag, $PropagationFlag, $objType)
                    
$objACL = Get-ACL ($dir+$deptListCode)
                  
$objACL.AddAccessRule($objACE)

Set-ACL ($dir+$deptListCode) $objACL

both of folder and the ad group are created, but the group just can not be set to the folder


any help, thanks in advance

Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>