≡ Menu

How to get hardware details of servers using powershell

I know many people have already figured it out in powershell way. I got similar requirement today morning where I have to check hardware make and model of 10 servers. That made me to recollect one of my old experience where I wrote a VB script to do the task. That time it took almost 2-3 hours to make the script ready. It took so long because of two reasons, number#1 I am new to VB scripting, number#2, I don’t know how to get this information. But it didn’t take that long today because of powershell as number#1 is not valid as I already gained some knowledge and number# as I already know from where I should get this info. So, I wrote below code in three minutes and gathered the output.

function get-hwinfo {

param($computer)

gwmi -query “select * from win32_computersystem” -computername $computer | select Name, Manufacturer, Model

}

$servers = Get-Content c:tempservers.txt

$servers | % { Get-hwinfo -computer $_ }

Hope this little code help you to pull the required information from servers.  I will try to write a script to gather complete hardware configuration when I get some time. 

Do you have a complete script which can get full hardware details? Share it.

Comments on this entry are closed.