The objective of this procedure is to display the Active Directory (AD) description attribute in a State View in the SCOM 2012 R2 Admin Console. The basic steps are:
- Create a VB script to write the AD description attribute to a system environment variable called ADDescription.
- Assign the script as a Group Policy Startup script.
- Configure a new Custom Attribute in the SCOM console to read the ADDescription value from the registry.
- Create a State View in the SCOM console and expose the column containing the value of ADDescription for relevant devices.
The Windows Computer class has already been extended so that the Windows Computer_Extended class already exists and there is an unsealed management pack available to save custom settings to.
Step 1 – The script
On Error Resume Next
Dim WSHShell, strComputer, strDescription, objSysInfo, objComp
Set WSHShell = WScript.CreateObject(“WScript.Shell”)
Set objSysInfo = CreateObject(“ADSystemInfo”)
Set objComp = GetObject(“LDAP://” & objSysInfo.ComputerName)
strDescription = objComp.Description
WSHShell.RegWrite “HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\ADDescription”, strDescription, “REG_SZ”
Step 2 – Group Policy
- In the Group Policy Management console select the relevant OU against which the new policy object is to be applied, e.g. the Default Domain Policy, and select Edit from the context menu.
- In the Group Policy Editor navigate to Computer Configuration # Policies # Windows Settings # Scripts # Startup and assign the script created in Step 1.
Step 3 – Create a Custom Attribute in SCOM
- Go to the Authoring workspace in the SCOM console.
- Select Management Pack Objects # Attributes.
- Create a new attribute using these settings:
- Discovery Type – Registry
- Target – Windows Computer_Extended.
- Key or Value Type – Value,
- Path = SYSTEM\CurrentControlSet\Control\Session Manager\Environment\ADDescription.
- Attribute type = String.
- Query Interval – to suit the target environment.
Step 4 – Create the State View
- Access the SCOM monitoring workspace.
- Ensure the custom management pack used to save the ADDescription attribute to is viewable.
- Create a new State View, setting the Object to Windows Computer_Extended and use the Display tab to select the relevant columns which will included the ADDescription.