gcue Posted June 17, 2008 Share Posted June 17, 2008 has anyone figured out how to do this? thx Link to comment Share on other sites More sharing options...
mdwerne Posted June 17, 2008 Share Posted June 17, 2008 How about this?http://support.microsoft.com/kb/232243-Mike Link to comment Share on other sites More sharing options...
gcue Posted June 17, 2008 Author Share Posted June 17, 2008 (edited) id like to be able to do it through autoit - if possible. (ive already this whole arsenal of tools built into one tool - would like to keep it within autoit Edited June 17, 2008 by gcue Link to comment Share on other sites More sharing options...
cal Posted June 22, 2008 Share Posted June 22, 2008 (edited) Yes, it can be done. You need to look into WMI objects. You can query remote systems directly and return all sorts of info. Here is an example. (none of this code will work standalone, I just want to point you in the right direction.) Func get_compsystem() $objWMIService = ObjGet("winmgmts:\\" & $comp_name & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) For $objItem In $colItems $bios_brand = $objItem.Manufacturer $bios_model = $objItem.Model $totalmem = Round($objItem.TotalPhysicalMemory / 1024 / 1024,0) & ' MB' $logged_on_user = $objItem.UserName; logged on user. if no user this will be blank. Next EndFunc For uptime however look into colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) Your interested in $lbt = $objItem.LastBootUpTime $ldt = $objItem.LocalDateTime to get the last boot and local time of the remote system. Use _DateDiff to get the difference in seconds and then calculate it out to get your answer in days,hours,min,seconds. Look for a script called "scriptomatic". Its an amazing piece of work that shows examples of how to use WMI in autoit while showing the results from querying your own machine. Hopefully this points you in the right direction. When I discovered WMI objects I suddenly had a means to get amost any info I needed from network machines. Check them out. Scriptomatic helped me alot in figuring out how to interact with them. Edited June 22, 2008 by cal Link to comment Share on other sites More sharing options...
Stretch Posted June 22, 2008 Share Posted June 22, 2008 I had to do this in a project I did. With some help from ChrisL at work, I used this. #include <Date.au3> $aTSB = DllCall ("kernel32.dll", "long", "GetTickCount") $ticksSinceBoot = $aTSB[0] dim $iHours, $iMins, $iSecs _TicksToTime ( $ticksSinceBoot, $iHours, $iMins, $iSecs ) $iDays = int($iHours / 24) $iHours = $iHours - ($iDays * 24) $uptime = ($iDays& " days, "&$iHours &" hours, "&$iMins & " Minutes, and "&$iSecs& " Seconds" ) msgbox(0,"Computer Uptime",$uptime) Hope it helps. 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