Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Help with WMI query

$
0
0

Hi,

 

I am attempting to create a script that will query WMI for the "LastBootUpTime" of the local computer.

It seems I am up against what I believe are Syntax errors, I have attempted to convert the code from VB Script but it does not help.

 

Using snippets from the forum I have managed to get something together but there is no output no matter how I approach it.

 

$objWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & '\root\cimv2:Win32_OperatingSystem')

MsgBox(0, "Boot Time", "Last Reboot " & $objWMI.LastBootUpTime)

 

The converted code:

$strComputer = "."
 $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
 $colItems = $objWMIService.ExecQuery( _
    "SELECT * FROM Win32_OperatingSystem WHERE LastBootUpTime = 20130513124052.319668+600",,48)

 

The format I am attempting to output is: yyyy/mm/dd/hh/mm/ss although if I can just get some output I am sure I can work it out.

 

Can anyone point me to anything to assist, I am quite new to AUTOIT and a complete novice extracting info from WMI.

 

Thanks

Just a little less hair after today..;)

 

 


Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>