Create User
Set DomainObj = GetObject("WinNT://Domain")
Set UserObj = DomainObj.Create("user", ""Someone"")
UserObj.SetInfo
Set UserObj = Nothing
Delete User
DomainString = "Domain"
UserString = "Someone"
Set DomainObj = GetObject("WinNT://" & DomainString)
DomainObj.Delete("user", UserString)
Set DomainObj = Nothing
Add user to a Group
DomainString = "Domain"
UserString = "Someone"
GroupString = "Somegroup"
Set GroupObj = GetObject("WinNT://" & DomainString & "/" & GroupString)
GroupObj.Add ("WinNT://" & DomainString & "/" & UserString)
Set DomainObj = Nothing
Set GroupObj = Nothing
Delete a group
DomainString = "Domain"
GroupString = "Somegroup"
Set DomainObj = GetObject("WinNT://" & DomainString)
DomainObj.Delete("group", GroupString)
Set DomainObj = Nothing
List Users in a Group.
DomainString = "Domain"
GroupString = "Somegroup"
Set GroupObj = GetObject("WinNT://" & DomainString & "/" & GroupString)
For each UserObj in GroupObj.Members
List = List & UserObj.Name
Next
Wscript.Echo List
Start Service
Set BrowserServiceObj = GetObject("WinNT://ComputerName/wmi")
BrowserServiceObj.start
Set BrowserServiceObj = Nothing
Stop Service
Set MessengerServiceObj = GetObject("WinNT://ComputerName/messenger")
MessengerServiceObj.stop
Set MessengerServiceObj = Nothing