मैंने इसके बारे में कई पोस्ट पढ़ी हैं, लेकिन मुझे अभी भी यह नहीं मिल रहा है। मैं इस स्क्रिप्ट को व्यवस्थापक के रूप में चला रहा हूं और यह आवश्यक फ़ोल्डरों को बनाता है, बस उपयुक्त अनुमतियां सेट नहीं करता है। किसी भी सहायता की सराहना की जाएगी। धन्यवाद!पावरशेल फ़ोल्डर अनुमति त्रुटि - कुछ या सभी पहचान संदर्भों का अनुवाद नहीं किया जा सका।
$Users = Get-Content "D:\New_Users.txt"
ForEach ($user in $users)
{
$newPath = Join-Path "F:\Users" -childpath $user
New-Item $newPath -type directory
$UserObj = New-Object System.Security.Principal.NTAccount("DOMAIN",$user)
$acl = Get-Acl $newpath
$acl.SetAccessRuleProtection($True, $False)
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("O1OAK\$user","AppendData,CreateDirectories,CreateFiles,DeleteSubdirectoriesAndFiles,ExecuteFile,ListDirectory,Modify,Read,ReadAndExecute,ReadAttributes,ReadData,ReadExtendedAttributes,ReadPermissions,Synchronize,Traverse,Write,WriteAttributes,WriteData,WriteExtendedAttributes","ContainerInherit, ObjectInherit","None","Allow")
$acl.SetAccessRule($accessRule)
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("NT AUTHORITY\SYSTEM","FullControl","ContainerInherit, ObjectInherit","None","Allow")
$acl.SetAccessRule($accessRule)
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("BUILTIN\Administrators","FullControl","ContainerInherit, ObjectInherit","None","Allow")
$acl.SetAccessRule($accessRule)
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("1OAK\$user","Delete","ContainerInherit, ObjectInherit","None","Allow")
$acl.removeAccessRule($accessRule)
$acl.SetOwner($UserObj)
$acl | Set-Acl $newpath
}
3 कि मैं पाने के एक स्ट्रिंग में पहली त्रुटि के नीचे है। मुझे लगता है कि सबसे महत्वपूर्ण है और अन्य 2.
Exception calling "SetAccessRule" with "1" argument(s): "Some or all identity references could not be translated."
At D:\DOMAIN\IT\IT Private\User Drives\user_folders.ps1:12 char:20
+ $acl.SetAccessRule <<<< ($accessRule)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
ठीक कर देंगे मुझे आशा है कि यह एक नकली नहीं है और मैं माफी चाहता हूँ अगर यह होता है, मैं घंटों के लिए पढ रहा हूं। धन्यवाद! Some or all identity references could not be translated.
यह खाता नहीं पाया जा सका का अर्थ है:
1 वें $ accessRule में पहचान पैरामीटर के पास डोमेन नाम 'O1OAK' चौथा '1 ओक' है। यह कठोर है? –