AD账号加到本机Power Users

大家都知道,在域环境中,默认情况下,所有域用在本地电脑中只有Users组的权限,但是,在实际应用中,Users的权限很少,连设置共享都不行,有些环境需要给域用户POWER USERS的权限,下面的脚本,就是为实现些功能而写!

注意上:应用时,请将下面黑体的domain改为你自已的域名!

dim sFlag
Dim oWshNetwork
Set oWshNetwork = WScript.CreateObject("WScript.Network")

strComputer = oWshNetwork.ComputerName
sFlag=0
Set colGroups = GetObject("WinNT://" & strComputer & "/power users")

For Each objUser In colGroups.Members
    'Wscript.Echo  objUser.Name
  
Next

strTestString = "/" & strComputer & "/"

Set colGroups = GetObject("WinNT://" & strComputer & "/power users")

For Each objUser In colGroups.Members
    If InStr(objUser.AdsPath, strTestString) Then
        'Wscript.Echo "Local user: " & objUser.Name
    Else
        IF objuser.Name = "Domain users" Then
           sFlag=1                      
            'wscript.echo "IN"  
        end if
     
      'Wscript.Echo "Domain user: " & objUser.Name
    
    End If
Next
if sFlag=0 then
   'wscript.echo "NO"
Set objGroup = GetObject("WinNT://" & strComputer & "/power users")
             Set objUser = GetObject("WinNT://domain/domain users")
             objGroup.Add(objUser.ADsPath)
end if            

本文出自 “大向技术分享” 博客,转载请与作者联系!

你可能感兴趣的:(职场,domain,power,users,users,休闲)