I can not change SID by name. please help-me
============================================================
D:\SIDlocal.csv
OLD;NEW
S-1-5-21-2824013475-2539778625-3844828982-1019;teste
S-1-5-21-2824013475-2539778625-3844828982-1029;teste - Gravacao
S-1-5-21-2824013475-2539778625-3844828982-1030;teste - Leitura
S-1-5-21-2824013475-2539778625-3844828982-1005;FTP Users
S-1-5-21-2824013475-2539778625-3844828982-1023;Gteste - Leitura
S-1-5-21-2824013475-2539778625-3844828982-1021;GTeste - Escrita
S-1-5-21-2824013475-2539778625-3844828982-1020;GSteste
S-1-5-21-2824013475-2539778625-3844828982-1026;Steste Gravacao
Scrpit PowerShell
==============================================================
$sids = import-csv -Delimiter ";" D:\SIDlocal.csv
foreach ($sid in $sids){
$old = $sid.OLD
$new = $sid.'NEW'
gci D:\servicos -recurse | %{
$acl = get-acl $_.FullName
$acl.Access | ?{$_.IdentityReference.Value -match $old} |%{
$identity = $_.IdentityReference.Value -replace $old,$new
$permission = $identity,$_.FileSystemRights,$_.InheritanceFlags,$_.PropagationFlags,$_.AccessControlType
$aR = New-Object system.security.accesscontrol.filesystemaccessrule $permission
$acl.RemoveAccessRule($_)
$acl.SetAccessRule($aR)
}
$acl | set-acl $_.FullName
}
}
=======================================================================
Error
Exception calling "SetAccessRule" with "1" argument(s): "Some or all identity references could not be translated."
At C:\TEMP\SID.ps1:16 char:13
+ $acl.SetAccessRule($aR)
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : IdentityNotMappedException