Sunday, August 12, 2012

Get CPU core information using Power-Shell

How to get cpu core information on windows 2003 and 2008 servers ?

The answer is here its just simple we can get CPU core information on all the servers provided in servers.txt file using power-shell script which uses WMI to get CPU core information from remote macines.

Save the below content to file coreinfo.ps1 and mention the server names in servers.txt file
----------------------------------------------------------

$Computers = Get-Content "C:\coreinfo\servers.txt"

ForEach ($cn in $computers)
{

Get-WmiObject Win32_Processor -ComputerName $cn | format-table SystemName, numberofcores, NumberOfLogicalProcessors –AutoSize
}
----------------------------------------------------------

The above script has been tested on windows 2008 servers and works perfectly fine

To run this script on Windows 2003 server machines you need to install below mentioned patches(whichever applies)

Windows 2003 Sp2 
http://support.microsoft.com/kb/936235 
http://support.microsoft.com/kb/932370 

No comments: