Fun with Powershell - Find serial number of physical servers

I have to do this quite a lot for my physical HP servers, and previously it was quite a time consuming task. So here is a small script which might make things a little easier.

$servers = Get-Content C:\powershell\Scripts\SerialNumber\servers.txt

foreach ($server in $servers) {
Get-WmiObject win32_bios -ComputerName $server -ErrorAction SilentlyContinue                         -ErrorVariable ProcessError | Select-Object pscomputername,serialnumber | Sort-Object PSComputername 
if($ProcessError) {
Write-Warning -Message "Something went wrong, with the server $server!!"

The good  thing about this is that, its got error handling in place. So if a script cannot find the information of a server, it will display a warning message with the server name, instead of spitting about that ugly red message in powershell by default.