【问题标题】:ICACLS add Local Group in powershellICACLS 在 powershell 中添加本地组
【发布时间】:2013-12-30 13:57:55
【问题描述】:

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

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

但是当我尝试 localmachine\localgroup 时会窒息...有什么想法吗?

我正在通过 powershell 执行此操作,但我认为这不应该是一个问题。我会得到 SID,但我猜这很棘手,因为我是通过调用命令在远程计算机上执行的

有什么想法吗?

谢谢!

【问题讨论】:

    标签: batch-file icacls


    【解决方案1】:

    尝试从localmachine\localgroup 中省略localmachine\。当您通过 PowerShell Remoting(特别是 Invoke-Command)部署 icacls 命令时,您不需要指定本地计算机名称。您可能会在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.
    

    【讨论】:

    • 试过了,没有骰子,它似乎是从本地机器而不是远程机器上读取 sids ...
    • 但是您是通过Invoke-Command 部署脚本,对吗? icacls.exe 应该在远程计算机上执行,并且对“本地计算机”的了解为零
    猜你喜欢
    • 2014-06-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-30
    相关资源
    最近更新 更多