exodius Posted November 15, 2007 Share Posted November 15, 2007 (edited) Can someone help me with translating this? I got as far as below, but I got hung up on what some of the syntax should be... computer="USC000012WKSS27" set wmi = getobject("winmgmts://" & computer) wql = "select * from win32_computersystem" set results = wmi.execquery(wql) for each o in results:set comp = o:exit for:next if isnull(comp.username) then msgbox "nobody home;-)..." else msgbox comp.username end if $computer="USC000012WKSS27" $oWmi = ObjGet("winmgmts://" & $computer) wql = "select * from win32_computersystem" set results = wmi.execquery(wql) for each o in results:set comp = o:exit for:next If isnull(comp.username) Then MsgBox (0, "", "nobody home) Else MsgBox (0, "", comp.username) EndIf Edited November 15, 2007 by exodius Link to comment Share on other sites More sharing options...
Valuater Posted November 15, 2007 Share Posted November 15, 2007 ****Tested OK***** $computer = "USC000012WKSS27" ; this needs to be "YOUR" computer name $oWmi = ObjGet("winmgmts://" & $computer) $wql = "select * from win32_computersystem" $results = $oWmi.execquery ($wql) For $result In $results If ($result.username) = "" Then MsgBox(0, "", "nobody home", 2) Else MsgBox(0, "", $result.username, 2) EndIf Next 8) Link to comment Share on other sites More sharing options...
Valuater Posted November 15, 2007 Share Posted November 15, 2007 (edited) Last Seen: 40 minutes ago8) Edited November 15, 2007 by Valuater Link to comment Share on other sites More sharing options...
exodius Posted November 15, 2007 Author Share Posted November 15, 2007 ****Tested OK***** $computer = "USC000012WKSS27" ; this needs to be "YOUR" computer name $oWmi = ObjGet("winmgmts://" & $computer) $wql = "select * from win32_computersystem" $results = $oWmi.execquery ($wql) For $result In $results If ($result.username) = "" Then MsgBox(0, "", "nobody home", 2) Else MsgBox(0, "", $result.username, 2) EndIf Next 8) Awesome, that works for me too, thanks Valuater! Link to comment Share on other sites More sharing options...
Valuater Posted November 15, 2007 Share Posted November 15, 2007 Welcome 8) Link to comment Share on other sites More sharing options...
JerryD Posted November 15, 2007 Share Posted November 15, 2007 You should also take a look at this post:http://www.autoitscript.com/forum/index.ph...criptomatic.au3 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now