Powershell script to enumerate server serial number, name, manufacturer

Requires an associated txt file with a list of server names/ ip addresses.

—————

#Pings a list of IP addresses, pulls the serial number, manufacturer and computer name from responsive computers

del C:\Support\Scripts\hardware\dellHardware.txt

#Reads from a list of servers
get-content c:\Support\Scripts\Hardware\dellST.txt | Foreach-Object {

#Sets $Result variable to output of test-connection
$Result = test-connection $_ -Quiet

#If $Result is false (i.e. this machine can’t connect to the remote server),
#Send an email out to support staff saying the remote server is down.
if ($Result -eq $True)
{
$details = Get-WmiObject win32_SystemEnclosure -ComputerName $_ | Select SerialNumber,PSComputerName,Manufacturer}
Add-Content -Path C:\Support\Scripts\hardware\dellHardware.txt $details
}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s