可以查询系统用户名sid的vbs
发布时间:2016-12-28 来源:查字典编辑
摘要:复制代码代码如下:setpath=wscript.createobject("wscript.shell")usera=path.Expan...
复制代码 代码如下:
set path=wscript.createobject("wscript.shell")
usera=path.ExpandEnvironmentStrings("%username%")
name=inputbox("请输入你要查询的用户名","sid查询--by不追不悔",usera)
strComputer = "."
Set wbemServices = Getobject("winmgmts:" & strComputer)
Set wbemObjectSet=wbemServices.execquery("select sid from win32_userAccount where name='"&name&"'")
For Each mo In wbemObjectSet
sSID = mo.sid
Next
If(sSID = "")Then
WScript.Echo "对不起,无此用户"
Else
WScript.Echo sSID
End If