Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file ICACLS在powershell中添加本地组_Batch File_Icacls - Fatal编程技术网

Batch file ICACLS在powershell中添加本地组

Batch file ICACLS在powershell中添加本地组,batch-file,icacls,Batch File,Icacls,您好,我正在跨服务器执行一些自动文件夹权限,我在远程计算机上创建了一个同名组,我正在尝试授予该组对文件夹的访问权限,但icacls似乎不喜欢本地组,它无法将它们添加到文件夹中 例如,它添加域\用户、域\组、内置\管理员 但是当我尝试localmachine\localgroup时,它被阻塞了。。。有什么想法吗 我是通过powershell完成这项工作的,但我认为这不应该成为一个问题。。我会得到SID,但我猜这很棘手,因为我是通过invoke命令在远程机器上执行的 有什么想法吗 谢谢 尝试从loc

您好,我正在跨服务器执行一些自动文件夹权限,我在远程计算机上创建了一个同名组,我正在尝试授予该组对文件夹的访问权限,但icacls似乎不喜欢本地组,它无法将它们添加到文件夹中

例如,它添加域\用户、域\组、内置\管理员

但是当我尝试localmachine\localgroup时,它被阻塞了。。。有什么想法吗

我是通过powershell完成这项工作的,但我认为这不应该成为一个问题。。我会得到SID,但我猜这很棘手,因为我是通过invoke命令在远程机器上执行的

有什么想法吗


谢谢

尝试从
localmachine\localgroup
中省略
localmachine\
。在通过PowerShell远程处理部署
icacls
命令时,不需要指定本地计算机名(特别是
Invoke命令
)。您可能会在
icacls
帮助中注意到,它不需要计算机名作为前缀

Examples:

        icacls c:\windows\* /save AclFile /T
        - Will save the ACLs for all files under c:\windows
          and its subdirectories to AclFile.

        icacls c:\windows\ /restore AclFile
        - Will restore the Acls for every file within
          AclFile that exists in c:\windows and its subdirectories.

        icacls file /grant Administrator:(D,WDAC)
        - Will grant the user Administrator Delete and Write DAC
          permissions to file.

        icacls file /grant *S-1-1-0:(D,WDAC)
        - Will grant the user defined by sid S-1-1-0 Delete and
          Write DAC permissions to file.

尝试了这一点,但没有成功,它似乎是从本地机器而不是远程机器读取SID…但您是通过
调用命令部署脚本的,对吗?icacls.exe应在远程计算机上执行,并且对“本地计算机”一无所知