我有以下脚本,它工作正常,但我如何设置它以保持安全设置并向安全组添加额外的“人”......
...并且cacls
可以更改文件夹的“所有者”吗?
我累了/e
来编辑而不是替换,但由于某些原因它不喜欢它?
Set WshShell = CreateObject("WScript.Shell")
strFolder = "D:\test"
setPerms = "%COMSPEC% /c echo Y| C:\windows\system32\cacls.exe """ & _
strFolder & """ /G mydomain\myusername:F & pause" 'added pause to see what the outcome is
WshShell.run setPerms
答案 0 :(得分:12)
CACLS
,您可以使用推荐的ICACLS
达到您想要的效果。你想要这样的东西:
icacls.exe d:\test /grant domain\username:F
添加权限并添加:
icacls.exe d:\test /setowner domain\username
设置所有权。其他感兴趣的选项来自icacls /?
:
/T indicates that this operation is performed on all matching
files/directories below the directories specified in the name.
/C indicates that this operation will continue on all file errors.
Error messages will still be displayed.