SCOM – Get values from your own built extended class with powershell

Summary

Do you want to display or use custom attribute values from your extended classes in SCOM using PowerShell?
Yes—you can! The following PowerShell commands show how to access and work with extended class instances in Microsoft SCOM.

Description

First, you need to reference your extended class. In this example, I’ve extended the built-in SCOM class called “Windows Computer”. The extended version is named “Windows Computer Extended Attributes”.

I populated this extended class with custom data from monitored Windows and Linux servers—including values such as:

    • Server function
    • Server type
    • Team or department ownership
    • Additional metadata from the registry or WMI

With this approach, you can filter, group, and sort monitored objects dynamically within the SCOM console using your extended attributes.

Even better—you can retrieve and work with these values in PowerShell, opening the door to powerful custom scripts and automation.

PowerShell Commands

1. Get the Extended SCOM Class

1
$Class = Get-SCOMClass | Where-Object {$_.DisplayName -eq "Windows Computer Extended Attributes"}

2. Get an Instance of a Monitored Object in the Extended Class

Replace the display name with the exact FQDN of the monitored server (e.g.,

1
"srv11111.domain.com"

1
$SCOMExAttr = Get-SCOMClassInstance -Class $Class | Where-Object { $_.DisplayName -eq "srv11111.domain.com"}

3. Export All Attribute Names and Values to a Text File

This is helpful to identify available property names and values, including your custom attributes:

1
$SCOMExAttr | Format-List * >> "C:\Temp\srv11111.domain.com.txt"

In the exported file, you’ll find both default attributes from the base class and your custom imported attributes.


Relevant Attribute Names

The following attribute names are essential for continuing your PowerShell script.
Note that custom attribute names in your extended class are consistent across all monitored objects, as each one retains the same unique identifier (UID).

Custom Attributes:

  • Server Function:
    1
    [Typec3a7a87fba9948b2bccc46a3ea47fe9e].AttributeDiscoveryGeneratedByUI843f4fa102e24b2791be3ccce9441e92
  • Server Type:
    1
    [Type1a1021e9c2c6410dace6e73c3f95cb66].AttributeDiscoveryGeneratedByUIc16fe093d54846159a5f620545143277
  • Active Directory Site (Standard Attribute):
    1
    [Microsoft.Windows.Computer].ActiveDirectorySite

PowerShell Commands to Extract the Values

Use the following PowerShell lines to retrieve the values of these attributes from the extended class instance:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# Get Server Function
$SCOMExAttr.psobject.properties | ForEach-Object {
    if ($_.Name -like "*AttributeDiscoveryGeneratedByUI843f4fa102e24b2791be3ccce9441e92*") {
        $_.Value.Value
    }
}

# Get Server Type
$SCOMExAttr.psobject.properties | ForEach-Object {
    if ($_.Name -like "*AttributeDiscoveryGeneratedByUIc16fe093d54846159a5f620545143277*") {
        $_.Value.Value
    }
}

# Get Active Directory Site
$SCOMExAttr.psobject.properties | ForEach-Object {
    if ($_.Name -like "*ActiveDirectorySite") {
        $_.Value.Value
    }
}

Result

The script will output the corresponding values (e.g., server function, type, AD site) for the monitored object.
These values can be used to:

    • Populate custom alert fields
    • Drive dynamic notification logic
    • Enhance automated incident responses

 

 

 

Leave a Reply