Over time there have been several excellent posts to guide people in how to dynamically populate groups using regular expressions.The ones I found however did not answer the question I had regarding the grouping I wanted to make.
Consider the following situation:
Your servers are named as follows:
In the above situation I have multiple webservers (All starting with ‘NY-WEB’ or ‘LA-WEB’) and a bunch of other servers (Database, Biztalk, Terminal Server etc.). In my case I wanted to make a selection of all New York servers not being web-servers. Furthermore, since OpsMgr is case sensitive where it comes to groupings, I wanted to make the selection case insensitive.
In this case I could use a regular expression with an inclusion to include all servers starting with ‘NY-’ as well as an exclusion to exclude servers containing ‘web’ and get what I need. To achieve what I want, I need the following regular expression:
‘^(?i:ny-)’ will make a case insensitive selection of all servers starting with ‘ny-’. ‘(?i:web)’ is another case insensitive selection of all servers containing the text ‘web’, and this selection in turn is excluded by ‘(?!…)’, by which it is enclosed.
To create the group, perform the following steps:
- In the operations console, create a new Group under ‘Authoring’ > ‘Groups’
- Give it a name of your choice and select a managementpack to save it in (not the default managementpack)
- Select ‘Next’ twice and click ‘Create/Edit Rules…’
- Verify ‘Windows Computer’ is selected and click ‘Add’
- Now select ‘principal name’ > ‘Matches regular expression’
- Now entering this: ^(?i:ny-)(?!(?i:web)).*$ should do the trick
- Click ‘OK’
- Click ‘Next’ twice and ‘Create’
- Now test your group by selecting the group and clicking ‘view group members…’
Some very good posts on regular expressions in Operations Manager can be found here:
- OpsManJam Regex Documentation