本帖最后由 lxzzr 于 2013-8-13 23:40 编辑
准确的应该是附加源对象的权限到目标。 | | | | | | | | | | | | | | | | | | | | | | | If WScript.Arguments.Count < 2 Then | | WScript.Echo "Usage: CloneACL <sObjectPath(file or Folder)> <dObjectPath(file or Folder)>" | | WScript.Quit 1 | | End If | | | | sObjectPath = WScript.Arguments( 0 ) | | dObjectPath = WScript.Arguments( 1 ) | | Set ObjWMI = GetObject("winmgmts:" & "{impersonationLevel=impersonate, (Security)}!\\.\root\cimv2") | | | | Set scr = ObjWMI.Get("Win32_LogicalFileSecuritySetting=""" & Replace( sObjectPath,"\","\\") & """" ) | | sReturn = scr.GetSecurityDescriptor( objSD ) | | If ( sReturn <> 0 ) Then | | WScript.Echo "Could not get security descriptor: " & sReturn | | wscript.Quit sReturn | | End If | | | | Set dst = ObjWMI.Get("Win32_LogicalFileSecuritySetting=""" & Replace( dObjectPath,"\","\\") & """" ) | | dReturn = dst.SetSecurityDescriptor( objSD ) | | If ( dReturn <> 0 ) Then | | WScript.Echo "Could not set security descriptor: " & dReturn | | wscript.Quit dReturn | | End IfCOPY |
https://www.enun.net/?p=2308 |