$ScriptName = “CAL.Template_with_.DS.ps1” # ScriptName should be the same as the ID of the module that the script is contained in # Assign script name variable for use in event logging. # Manual Testing section - put stuff here for manually testing script - typically parameters: Param($SourceId,$ManagedEntityId,$ComputerName,$MGName,$DebugLogging,$ComputerNameList) # SCOM Script to discover instances of a class when provided a list of ComputerNames 0 31bf3856ad364e35 $Config/IntervalSeconds$ $Config/SyncTime$ Demo.M圜.DS.ps1 ![]() Demo.DiscoverClassByServerName 1.0.0.0 Demo.DiscoverClassByServerName. My MP example is below, or you can get the fragment from my fragment library: Add new ones, and just make sure to enable the discovery so it runs for them. If you want to remove a server, simply edit the discovery and take the name out. I can now write simple rules and monitors, and have a good class for targeting. When I go look in discovered inventory – I can see my instances have discovered: so I will override the discovery just for the servers that I want it to run on. The discovery in this MP is disabled by default (because I don’t want to run this script on ALL machines…. Then, I import the MP, and need to override the discovery. I only need to provide the standard stuff, then a comma separated list of server names that I want to be members of the class. I will import this fragment using Silect MP Author Pro, but it works the same in Visual Studio (VSAE). This fragment will let you discover instances of a custom class, and will only discover an instance if the computer name matches a static list. This fragment is called .ByServerName.mpx. I have a fragment that might help with that. SCOM uses a discovery model for targeting, and sometimes there just isn’t an easy way to discover what you want. You “could” create the service monitors disabled, target something generic like “ Windows Server Operating System” then override the monitors to enabled for the group. ![]() You cannot target workflows at groups, as the workflow will not execute on the group members. What customers would often LIKE to do, is simply create a group of Windows Computers, and just target the service monitors to the group. In SCOM – doing something that sounds so easy, actually isn’t. Often times, a customer will come to you and say “I just wanted to monitor for three services on those 5 computers” When creating rules and monitors in SCOM, we need a good, specific class for targeting.
0 Comments
Leave a Reply. |