Hi All,
Am using this below code snippet to get current logged in user, it works fine over here...
strComputer = "."Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM Win32_ComputerSystem",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "Win32_ComputerSystem instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "UserName: " & objItem.UserName
Next
I tested in another system having 3 users , but its not fetching the username...its returning NULL value.
What would be the problem...?
Thanks
Divakar