Sign in to follow this  
Followers 0
evilertoaster

Ram And Cpu From Remote Pc

9 posts in this topic

#1 ·  Posted (edited)

Does any one know a way to get the total RAM and processor speed of a remote pc. I'm thinking a registry key or file might have this somewhere but i can't find it...

Edited by evilertoaster

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Does any one know a way to get the total RAM and processor speed of a remote pc. I'm thinking a registry key or file might have this somewhere but i can't find it...

Try this:

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$computerName = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $computerName & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$CPUSpeed = $objItem.CurrentClockSpeed
Next
EndIf
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
    For $objItem In $colItems
        $Memory = $objItem.TotalPhysicalMemory
    Next
EndIf

Now you (I hope) you get $CPUSpeed and $Memory :)

Edited by spanga

Share this post


Link to post
Share on other sites

spanga, this is a fantastic tip. I had no idea that AutoIt could do this. Thanks!

Of course, I don't really have any burning need to do something like this at the moment, but I'm sure it'll be helpful in the future. :)

Share this post


Link to post
Share on other sites

Try this:

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$computerName = "localhost"
$objWMIService = ObjGet("winmgmts:\\" & $computerName & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$CPUSpeed = $objItem.CurrentClockSpeed
Next
EndIf
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
    For $objItem In $colItems
        $Memory = $objItem.TotalPhysicalMemory
    Next
EndIf

Now you (I hope) you get $CPUSpeed and $Memory :)

this is quite amazing.

how can i find more WMI objects to call and a little in depths look (from a newbie point of view) of object calling from AUTOIT?

thanks.

this has totally sparked my interest.


---"Educate the Mind, Make Savage the Body" -Mao Tse Tung

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

I fyou want to start using WMI there is only 1 way

Scriptomatic V2.0

Look via the Search in the script and scratch forum, because there is a version for AutoIt as well.

Enjoy !!

Is that like scratch and sniff :) --- Just ribbing ya a bit, we all know you meant Scripts and Scraps :(

Here is the link: http://www.autoitscript.com/forum/index.ph...hl=Scriptomatic


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Hey, respone is a bit late but yea thanks for showing me that spanga, i hade no idea WMi could access remtote machines...just for some clarification- 'winmgmts:\\' is what makes it connect to a remote PC right? is there an MSDN page on this? after you connect like that is there a way to show what WMI objects are aviable on a remote machine like scriptomatic does on a local one? are do you just guess^^?

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0