使用Powershell和UNC路径更改NTFS权限

时间:2018-07-04 11:51:20

标签: powershell ntfs unc

我正在尝试使用Powershell上的UNC路径更改某些NTFS权限。我只能使用\\ hostname \ folder访问此文件夹。

我需要修改NTFS权限,而不是共享权限。

我正在尝试:

$Pathv6 = '\\MyHostname\folder'
$acl = Get-Acl $Pathv6 
$acl.SetAccessRuleProtection($true,$false)
$ar = new-object System.Security.AccessControl.FileSystemAccessRule('User01', 'Modify',"ContainerInherit, ObjectInherit","None","Allow")
$acl.AddAccessRule($ar)
set-acl -Path $Pathv6 -AclObject $acl

此代码显示错误:

set-acl : No se pudieron convertir algunas o todas las referencias de identidad.
At C:\Datos\ArregloACL.ps1:37 char:5
+     set-acl -Path $Pathv6 -AclObject $acl
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (\\MyHostname\...\Client.v6:String) [Set-Acl], IdentityNotMappedException
    + FullyQualifiedErrorId : System.Security.Principal.IdentityNotMappedException,Microsoft.PowerShell.Commands.SetAclCommand

如何使用UNC和Powershell修改NTFS权限?

0 个答案:

没有答案