JSI Tip 10100. How can I determine if the WinNT provider returned a user, group, computer, etc.?

Jerold Schulman

January 29, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today


If you retrieve a script argument using the WinNT provider, you can use the Class property of the object to determine what type of object the argument was.

If your c:utiltest0.vbs script contains:

Dim objArguments, strDomainUser, ClsSet objArguments = Wscript.ArgumentsIf WScript.Arguments.Count = 0 then Wscript.QuitstrDomainUser=objArguments(0)Cls="NOT FOUND"On Error Resume Next Set objUser = GetObject("WinNT://" & strDomainUser ) Cls=objUser.ClassWscript.Echo 

" & strDomainUser &

 " & ClsWscript.Quit

Then see the following:

cscript //nologo c:utiltest0.vbs "JSIINC/Domain Admins""JSIINC/Domain Admins" Groupcscript //nologo c:utiltest0.vbs "JSIINC/Jerry""JSIINC/Jerry" Usercscript //nologo c:utiltest0.vbs "JSIINC/JSI001""JSIINC/JSI001" Computercscript //nologo c:utiltest0.vbs "JSIINC""JSIINC" Domain



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like