On Error Resume Next
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_UserAccount Where LocalAccount='False'")
For Each objItem in colItems
WScript.Echo objItem.Name & "," & objItem.SID
Next
在域内的机器上使用cscript运行脚本就可以了,配合 > 把输出结果重定向到csv格式的文件
命令提示符下
cscript test.vbs > result.csv