|
Option Explicit
Dim oWshNetwork
Set oWshNetwork = WScript.CreateObject("WScript.Network")
Dim sLogonComputerName
'得到当前登录计算机名
sLogonComputerName = oWshNetwork.ComputerName
'WScript.Echo sLogonComputerName
Dim oLocalGroup
'得到本地 Power Users Group 对象
Set oLocalGroup = GetObject("WinNT://" + sLogonComputerName + "/administrators,Group")
'WScript.Echo oLocalGroup.Name
dim username
username = inputbox("zhouqi@cinqsoft.com")
'注意下一句中的 HENU-SOFTLAB 它必须与域的NETBIOS名大小写相一致,否则会出错
If oLocalGroup.IsMember("WinNT://cinqsoft/" + username) Then
WScript.Quit
Else
'oLocalGroup.Add "WinNT://cinqsoft/Domain Users"
oLocalGroup.Add "WinNT://cinqsoft/" + username
End If
wscript.echo "当前域用户已经提升到本地超级管理员权限!"
|
|