Search


Sponsors

OpsMgr 2007: How to schedule discover and install agent as MOM 2005

Operations Manager 2007 Tarek Ismael writes: As Before in MOM 2005, you can automatic discover your server and install agents without run the wizard every time. Now in system center Operations Manager, this is not available but you can do this using Shell command. the Script can be using to run a Windows schedule task to discover and install Ops Mgr 2007 agent based on your LDAP query

param ($OpsMgrservername,$Domainname)
#Initialize the OpsMgr Provider
Add-PSSnapin Microsoft.EnterpriseManagement.OperationsManager.Client
# Set the location to the root of the provider namespace.
cd OperationsManagerMonitoring::
#create a connection to the Management Group
New-ManagementGroupConnection $OpsMgrservername
#change the path
cd $OpsMgrservername
#configure query setting
$ldap_query = new-ldapquerydiscoverycriteria -domain $Domainname -ldapquery "(sAMAccountType=805306369)(name=*ABC*)"
#configure discovery setting
$windows_discovery_cfg = new-windowsdiscoveryconfiguration -ldapquery $ldap_query
# discoveryresults
$discovery_results = start-discovery -managementserver (get-managementserver)-windowsdiscoveryconfiguration $windows_discovery_cfg
#install Agent
install-agent -managementserver (get-managementserver) -agentmanagedcomputer $discovery_results.custommonitoringobjects

Save the file as Agentdiscoverinstall.ps1. Configure the Windows schedule task as Powershell.exe Agentdiscoverinstall.ps1 -OpsMgrservername:localhost -Domainname:YOURDOM



  
Remember personal info?

Emoticons / Textile

Before sending a comment, you have to correctly answer a simple question you know the answer to. This is a countermeasure against automated spam bots.
 

  ( Register your username / Log in )

Notify:
Hide email:

Small print: All html tags except <b> and <i> will be removed from your comment. You can make links by just typing the url or mail-address.