objWMIService.ExecQuery
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- milend1966
- Posts: 7
- Last visit: Tue Feb 28, 2012 2:37 am
objWMIService.ExecQuery
Hi, i need to run the script below:'On Error Resume NextstrComputer = "."Wscript.Echo "PC "&strComputer Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem",,48)For Each objItem in colItems Wscript.Echo "UserName: " & objItem.UserName NextMy problem is that on lab PC it works and returns the user logged on, on production PC it returns null value. The operative system is the same W2003 EE. I know that there are other ways to retrieve this information, but i need to know why objItem.UserName does not work always...thanks
- milend1966
- Posts: 7
- Last visit: Tue Feb 28, 2012 2:37 am