welcome System Center 2007!

System Center Operations manager 2007 in Egypt

قُل لّوْ كَانَ الْبَحْرُ مِدَاداً لّكَلِمَاتِ رَبّي لَنَفِدَ الْبَحْرُ قَبْلَ أَن تَنفَدَ كَلِمَاتُ رَبّي وَلَوْ جِئْنَا بِمِثْلِهِ مَدَداً

Tuesday, July 10, 2007

How to schedule discover and install agent as MOM 2005

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:tarek

No comments: