I've just read this article from Tommy Gunn : OpsMgr 2012: Installing OpsMgr 2012 Agents from the Command Line
The script provided by Joe Thompson allow you to install the SCOM 2012 Agent and the CU1 with a single command line :
msiexec /i MOMAgent.msi /qn /l*v %TEMP%\install.log PATCH="C:\MyPath\KB2674695-amd64-Agent.msp USE_SETTINGS_FROM_AD=0 USE_MANUALLY_SPECIFIED_SETTINGS=1 MANAGEMENT_GROUP=MYNEWMG MANAGEMENT_SERVER=SCOM2012.MYDomain.net SECURE_PORT=5723 ACTIONS_USE_COMPUTER_ACCOUNT=1"
Be sure parameter are correct to launch the command line.
Here is the script :
- ' OMINSTALL.VBS
- ' Version 1 (2012-06-27)
- ' Joe Thompson, EP Energy LLC
- ' OM 2012 vbs installer with CU1 agent patch and MGMT Group reconfig
- Option Explicit
- Dim sho, sCurPath, oReg, strKeyPath, strValueName, strComputer, strCmd, strVal, objMSConfig, intSleep, intRet
- Set sho = Wscript.CreateObject("Wscript.Shell")
- sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
- strComputer = "."
- intSleep = 15000
- wscript.echo "Running installer..."
- strCmd = "msiexec /i MOMAgent.msi /qn /l*v %TEMP%\install.log PATCH=" & sCurPath & "\KB2674695-amd64-Agent.msp USE_SETTINGS_FROM_AD=0 USE_MANUALLY_SPECIFIED_SETTINGS=1 MANAGEMENT_GROUP=MYNEWMG MANAGEMENT_SERVER=SCOM2012.MYDomain.net SECURE_PORT=5723 ACTIONS_USE_COMPUTER_ACCOUNT=1"
- wscript.echo strCmd
- intRet = sho.run(strCmd,0,True)
- ' Let things calm down
- wscript.echo "Sleeping..."
- WSCript.Sleep intSleep
- ' Check registry for OM Mgmt Group info
- If intRet <> 0 Then
- wscript.Echo "Install error occurred.... "
- wscript.quit(intRet)
- Else
- On Error Resume Next
- wscript.echo "Checking registry for OM 2012 EPE Mgmt Group info..."
- strVal = sho.RegRead("HKLM\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Agent Management Groups\MYNEWMG\")
- If Err <> 0 Then ' regkey doesn't exist
- wscript.echo "Didn't find OM 2012 EPE Mgmt Group info, setting config..."
- Set objMSConfig = CreateObject("AgentConfigManager.MgmtSvcCfg")
- 'Add a management group
- Call objMSConfig.AddManagementGroup ("MYNEWMG", "SCOM2012.MYDomain.net",5723)
- WSCript.Sleep intSleep
- wscript.echo "Reloading agent Mgmt Group configuration..."
- Call objMSConfig.ReloadConfiguration
- End If
- End If
- wscript.quit(intRet)
This posting is provided "AS IS" with no warranties.
No comments:
Post a Comment