Today I got a question from a co-worker about retrieving the monitored network devices by OM2012 using PowerShell. For Agents it’s pretty simple, you just use the Get-SCOMAgent Cmdlet and you have a nice overview of the Agents being monitored by OM2012.
But which Cmdlet should you use to get an overview of the monitored network devices? There is no Get-SCOMNetworkDevice Cmdlet.
To retrieve the network devices being monitored by OM2012, you need the following Cmdlets Get-SCOMClass and Get-SCOMClassInstance.
Get-SCOMClass -DisplayName "Network Device"| Get-SCOMClassInstance
If you want to retrieve some more info about the network devices being monitored you can use the following PowerShell commands.
$SCOMNetworkDevices= Get-SCOMClass -DisplayName "Network Device"| Get-SCOMClassInstance$SCOMNetworkDevices| Format-List *$SCOMNetworkDevices| select ManagementGroup, DisplayName, @{Label="AccessMode";Expression={$_.'[System.NetworkManagement.Node].AccessMode'}},@{Label="Certification";Expression={$_.'[System.NetworkManagement.Node].Certification'}}, @{Label="SystemObjectId";Expression={$_.'[System.NetworkManagement.Node].SystemObjectId'}}
DISCLAMER: This Sample Code is provided for the purpose of illustration only.
THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute
the object code form of the Sample Code, provided that You agree: (i) to not use Our name, logo, or trademarks to market Your software
product in which the Sample Code is embedded; (ii) to include a valid copyright notice on Your software product in which the Sample Code is
embedded; and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims or lawsuits, including
attorneys' fees, that arise or result from the use or distribution of the Sample Code.