MOM 2005 use the file ManualMC.txt as a alternative to add computers that will be monitored. MOM will install agent on all computers that are in the file, but it can be boring mission to keep that file updated all the time. I have done a script that will quest Active Directory for computers in a OU. The result will then be written to ManualMC.txt. You can also add some machines in the script, so all computers don’t need to be in the same OU. Â Setup this script as a schedule task to run sometime every day.
Next time MOM run discovery a agent will be installed on all machines, or they will be placed under pending actions. That depends on your global settings. If you don’t want a machine to have a agent anymore, you can delete the name from ManualMC.txt and MOM will uninstall the agent at next discovery.
Machines in ManualMC.txt will be excluded if there is a exclude rule in the discovery settings.
You will find ManualMC.txt here %SYSTEM ROOT%\Program Files\Microsoft Operations Manager 2005\
This will be a default function in SCOM 2007. Before your start working with the script you will need to change
Path to the ManualMC.txt file
Computer name for computers that always will be included. If you want to add more than two you can add more Computer(X) lines, and also add the first Dom Computer (2) number.
'Machines that always will be included
Computers(0) = "APP03.DOMAIN.LOCAL"
Computers(1) = "APP02.DOMAIN.LOCAL"
Computers(2) = "APP01.DOMAIN.LOCAL"
'Add machines from list above
Const ForAppending = 8
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile _
("C:\manualmc.txt ", ForWriting)
For i = 0 to UBound(Computers)
'Query Active Directory for computer objects
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCOmmand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, Location from 'LDAP://OU=Fabrikam,DC=europe,DC=fabrikam,DC=net' " _
& "Where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
'Add machines from Active Directory result
Do Until objRecordSet.EOF