有谁知道如何使用vbscript查询本地组的成员并返回其状态,即启用还是禁用?
我有这个来获得小组成员资格:
Set objNetwork = CreateObject("WScript.Network")
strComputer = objNetwork.ComputerName
strGroup = "Users"
Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup & ",group")
For Each objMember In objGroup.Members
WScript.Echo objMember.Name
Next
OS = Windows 2008
答案 0 :(得分:1)
尝试这样的事情:
For Each objMember In objGroup.Members
If objMember.Class = "User" Then
Set objUser = GetObject("WinNT://" & strComputer & "/" & objMember.Name)
WScript.Echo objUser.Name & " [" & objUser.AccountDisabled & "]"
Else
WScript.Echo objMember.Name
End If
Next