Dynamically Grouping Computers by Active Directory Site in MOM 2005
| Thought this might be of interest to someone. Just a little tweak in MOM using custom computer attributes in MOM to address a management need. Problem: Create an easy way for administrators to put all computers in a given Active Directory Site (or group of sites in case of child sites in some scenarios) into maintenance mode on a scheduled basis when a physical site goes down for maintenance using maintenancemodeutility from the MOM 2005 SDK. Group should be self maintaining to account for computers added and removed from AD. Solution: Create a couple of custom computer attributes and a formula-driven computer group in MOM to group target servers based on AD site membership value stored in the registry. Create a computer attribute to collect Active Directory Site Membership We’re going to create a couple computer attributes that pull back the value for the registry key holding AD site membership. In the MOM Admin Console, browse to Computer Attributes. Create a computer attribute called "Active Directory Site Name - Win2003" (or something similar). Set the Type to 'Registry Value' On the Registry Path tab, click the Browse button and click through to registry path SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Site-Name On Value tab, choose 'Retrieve registry value and convert to string' Repeat the process for Windows 2000 computers, creating a computer attribute named "Active Directory Site Name - Win2000" or something similar, using the following registry key: SYSTEM\CurrentControlSet\Services\Netlogon\Parameters\DynamicSiteName Again, on Value tab, choose 'Retrieve registry value and convert to string'. NOTE: Windows 2003 registry also displays the AD site name in this path, but strangely, discovery failed on this OS. As a quick dodge to the issue, I just went for the value in the HKLM\Software hive in a separate computer attribute. Create a Formula-driven Computer Group to Add Desired Targets to Computer Group Based on Site Membership Computer Attribute In the MOM Admin Console, create a computer group. Name the group something intuitive, like ADSite1_Computers (where ADSite1 is name of site you wish to include in this computer group) On the Search for Computers tab, set search criteria to 'Servers' and 'Domain Controllers' with any name. You could restrict name as well if you like. On the Formula tab, use the following formula AttributeValue(Active Directory Site Name – Win2000)="ADSite1" OR AttributeValue(Active Directory Site Name – Win2003)=”ADSite1" And for dealing with child sites in a hub-and-spoke AD topology, where you may want to roll hub and child site computers into a single computer group, simply use the OR operator in the formula to include multiple sites, like so: AttributeValue(Active Directory Site Name – Win2000)="ADSite1" OR AttributeValue(Active Directory Site Name – Win2003)=”ADSite1" OR AttributeValue(Active Directory Site Name – Win2000)="ADSite2" OR AttributeValue(Active Directory Site Name – Win2003)=”ADSite2" etc, etc, etc, etc, Note: Site name is case sensitive in the formula. |










Comments on "Dynamically Grouping Computers by Active Directory Site in MOM 2005"
post a comment links to this post