Output displayname and IP address for SCOMagents

Got bored – wrote this little thing to output FQDN and IPaddress for all Windows and UnixLinux agents in my lab environment.

Could be useful for some people maybe.
 

ipmo operationsmanager
$nixservers = get-scomclass -name "Microsoft.Unix.Computer" | Get-SCOMMonitoringObject
$winservers = Get-SCOMClass -name "Microsoft.Windows.Computer" | Get-SCOMMonitoringObject

   
    Write-host "-----------------------------------------------------------------"
    write-host "-------------------- Unix Computers and IPs ---------------------"
    Write-host "-----------------------------------------------------------------"
foreach ($nix in $nixservers) 

    {
        write-host ([System.Net.Dns]::GetHostAddresses($nix) | foreach {echo $nix - $_.IpAddressToString})
    }


    Write-host "-----------------------------------------------------------------"
    write-host "------------------- Windooze Computers and IPs ------------------"
    Write-host "-----------------------------------------------------------------"
foreach ($win in $winservers) 

    {
        write-host ([System.Net.Dns]::GetHostAddresses($win) | foreach {echo $win - $_.IpAddressToString})
    }

 
Thank god it’s Friday…

-F

Find server OS with Powershell and TTL

This handy little thing will identify the Operating System on one or more servers, using the OS’s default TTL value as a trigger.
(Some OS’ uses different TTL values. Most of them are listed on this site.)

cls
 $servers = "Server1","Server2" 

foreach ($server in $servers) 

{ 
$TTL = Test-Connection $server -Count 1 | select -exp ResponseTimeToLive

    Switch($TTL)
    {
        {$_ -le 64} {"$server runs Linux OS"; break}
        {$_ -le 128} {"$server runs Windows OS"; break}
        {$_ -le 255} {"$server runs UNIX OS"; break}
    }
}

– F