Hi, please help! i'm sooo close!
i run a FOREACH on the function below against 4 servers. if one of the servers is offline i only get 3 results back, how do i make it spit out a row indicating 'Command Failed' or 'Server unavailable' for the 4th server?
what i get now is an html table with:
PSComputerName LastBackupTime LastBackupResultDetailedHR
server1 6/18/2014 1:30:05 AM 0
server2 6/18/2014 1:00:14 AM 0
server4 6/17/2014 9:30:31 PM 0
And what i want is an html table with:
PSComputerName LastBackupTime LastBackupResultDetailedHR
server1 6/18/2014 1:30:05 AM 0
server2 6/18/2014 1:00:14 AM 0
server3 NO RESPONSE or Command Failed
server4 6/17/2014 9:30:31 PM 0
_____________________________________________________________________
function Get-WBStats
{
BEGIN {}
Process
{
Invoke-Command -ScriptBlock {
get-wbsummary
} -computername $Servername -credential $Cred | select PSComputerName,LastBackupTime,LastbackupResultDetailedHR
| sort pscomputername
}
END {}
}
Thank you, any help is appreciated.
MN