<p>Here is the usefull script that will get you server specifications like Server FQDN, Physical or Virtual info, Model, Total Memory, Bios Version, IP and MAC addresses, Subnet mask, Default Gateway, DHCP status, OS type, Service Pack, Serial Number etc.</p>
<p>Create a servers.txt file with the list of servers for which you want to get the server specifications. One server per line.</p>
<p><strong>C:\temp\serverslist.txt</strong></p>
<p><strong>serverslist.txt</strong> example:</p>
<p><em>hostname</em><br />
<em>hostname2</em><br />
<em>hostname3</em></p>
<p>Now create a new text file and rename it to <strong>serverlist.ps1</strong></p>
<pre>$Excel = New-Object -Com Excel.Application 
$Excel.visible = $True 
$Excel = $Excel.Workbooks.Add() 
# Insert text in to first row. 
$Sheet = $Excel.WorkSheets.Item(1) 
$Sheet.Cells.Item(1,1) = "Server" 
$Sheet.Cells.Item(1,2) = "FQDNName" 
$Sheet.Cells.Item(1,3) = "Manufacturer" 
$Sheet.Cells.Item(1,4) = "Model" 
$Sheet.Cells.Item(1,5) = "TotalPhysicalMemory" 
$Sheet.Cells.Item(1,6) = "isVirtual" 
$Sheet.Cells.Item(1,7) = "SerialNumber" 
$Sheet.Cells.Item(1,8) = "Bios Version" 
$Sheet.Cells.Item(1,9) = "IP Address" 
$Sheet.Cells.Item(1,10) = "MAC Address" 
$Sheet.Cells.Item(1,11) = "IPSubnet" 
$Sheet.Cells.Item(1,12) = "DefaultGateway" 
$Sheet.Cells.Item(1,13) = "Type" 
$Sheet.Cells.Item(1,13) = "DHCPEnabled" 
$Sheet.Cells.item(1,17) = "OperatingSystem" 
$Sheet.Cells.Item(1,18) = "ServicePack" 
$Sheet.Cells.item(1,19) = "BuildNumber" 
$Sheet.Cells.Item(1,20) = "BuildType" 
$Sheet.Cells.Item(1,21) = "Version" 
$Sheet.Cells.Item(1,22) = "SerialNumberOS" 
# Format colors. 
$WorkBook = $Sheet.UsedRange 
$WorkBook.Interior.ColorIndex = 15 
$WorkBook.Font.Bold = $True 
# Go to the second row. 
$intRow = 2 
# Select text file which contains list of servers to query. 
$arrComputers = GC C:\temp\serverslist.txt 
# Get currently logged in username, client name, manufacturer and model from Win32_ComputerSystem class. 
foreach ($strComputer in $arrComputers){ 
try { $colItems = Get-WmiObject Win32_ComputerSystem -Namespace "root\CIMV2" -ErrorAction stop -ComputerName $strComputer 
foreach($objItem in $colItems) { 
$Sheet.Cells.Item($intRow,1) = $objItem.Name 
$Sheet.Cells.Item($intRow,2) = ($objItem | % {$_.DNSHOSTName +'.'+$_.domain}).ToLower() 
$Sheet.Cells.Item($intRow,3) = $objItem.Manufacturer 
$Sheet.Cells.Item($intRow,4) = $objItem.Model 
$Sheet.Cells.Item($intRow,5) = ($objItem.TotalPhysicalMemory/1024MB) 
if($objItem.Model -like "VMWare*") 
{ 
$Sheet.Cells.Item($intRow,6) = "Yes" 
} 
Else 
{ 
$Sheet.Cells.Item($intRow,6)="No" 
} 
} 
# Get workstation serial number from Win32_BIOS class. 
$colItems = Get-WmiObject Win32_BIOS -Namespace "root\CIMV2" -ErrorAction stop -ComputerName $strComputer 
foreach($objItem in $colItems) { 
$Sheet.Cells.Item($intRow,7) = $objItem.SerialNumber 
if($objItem.BiosVersion -eq $null) 
{ 
$Sheet.Cells.Item($intRow,8)= "Unknown" 
} 
Else 
{ 
$Sheet.Cells.Item($intRow,8) = $objItem.BiosVersion[0] 
} 
} 
#Get OperatingSystme Imforamtion from Win32_OperatingSystem 
$colItems = Get-WmiObject Win32_OperatingSystem -Namespace "root\CIMV2" -ErrorAction stop -ComputerName $strComputer 
foreach($objItem in $colItems) { 
$Sheet.Cells.Item($intRow,17) = $objItem.Name | % { $_.Split("|")[0] } 
$Sheet.Cells.Item($intRow,18) = $objItem.servicepackmajorversion 
$Sheet.Cells.Item($intRow,19) = $objItem.BuildNumber 
$Sheet.Cells.Item($intRow,20) = $objItem.BuildType 
$Sheet.Cells.Item($intRow,21) = $objItem.Version 
$Sheet.Cells.Item($intRow,22) = $objItem.SerialNumber 
} 
# Get IP address and MAC address of the enabled network adapter from Win32_NetworkAdapaterConfiguration class. 
$colItems = Get-WmiObject Win32_NetworkAdapterConfiguration -Namespace "root\CIMV2" -ErrorAction stop -ComputerName $strComputer | where{$_.IPEnabled -eq “$true”} 
foreach($objItem in $colItems) { 
$Sheet.Cells.Item($intRow,9) = $objItem.IPAddress[0] 
$Sheet.Cells.Item($intRow,10) = $objItem.MACAddress 
$Sheet.Cells.Item($intRow,11) = $objItem.IPSubnet 
$Sheet.Cells.Item($intRow,12) = $objItem.DefaultIPGateway 
$Sheet.Cells.Item($intRow,13) = "IPv4" 
$Sheet.Cells.Item($intRow,14) = $objItem.DHCPEnabled 
$intRow+=1 
} 
} 
catch { 
Write-Host "Could not contact $($strComputer)" -ForegroundColor Red 
Out-File -FilePath C:\Noreach.txt -InputObject $strComputer -Append -Force 
} 
} 
</pre>
<p>Save the script to the same folder at <strong>C:\temp</strong>.</p>
<p>Before you&#8217;ll be able to run the script you will have to enable execution policy on your system (if you haven&#8217;t already):</p>
<p>Start the Powershell in elevated mode (Run as Administrator) and run the following command:</p>
<p><strong>Set-ExecutionPolicy RemoteSigned</strong></p>
<p>Now run the Powershell script by using this command:</p>
<p><strong>powershell -noexit &#8220;&; &#8220;&#8221;C:\temp\serverlist.ps1&#8243;&#8221;&#8221;</strong></p>
<p><a href="https://www.wincert.net/wp-content/uploads/2016/01/server-specifications-1.png" rel="attachment wp-att-1644"><img class="alignnone size-full wp-image-1644" src="https://www.wincert.net/wp-content/uploads/2016/01/server-specifications-1.png" alt="server specifications" width="603" height="59" /></a></p>
<p>You should get server specifications results on your screen.</p>

Powershell script to get server specifications
