(In this blogpost only handling x64 versions)
I had the challenge to automatic install and configure a SCOM multi-homed agent. I ran in to a couple of issues that I had to deal with – so today I am going to share my experiences regarding this with you.
First you need to copy the source files for the SCOM agent to your SCCM source files location.
The next thing you need to do is to download a copy of my PowerShell script (InstallSCOMMultiHome.ps1) created for the solution and place it in the content folder mentioned before.
Your content folder should look like below:
Now edit the variables in the InstallSCOMMultihome.ps1 script so it fits your environment. The variables you need to change are following:
#Define the SCOM Management server $SCOMMgmtServer1=“OM01.viamonstra.com“
#Define the correcponding management group$ManagementGroup1=“viamonstra-1“
#Define the SCOM Management server for the second server (Multi-home)$SCOMMgmtServer2=“OM02.corp.viamonstra.com“
#Define the management group for server 2 (Multi-home)$ManagementGroup2=“corp-viamonstra-1“
Next you need to create a SCCM package and a standard program.
When we run the program we’ll have to use a PowerShell Command to start the script. Because SCCM natively will start the x86 version of PowerShell and the script has some commands that are x64 specific we need to change the PowerShell version that SCCM will start.
So at your program command line type in the following to let SCCM start the x64 version of PowerShell (and run the script correctly):
“%WinDir%\Sysnative\WindowsPowerShell\V1.0\Powershell.exe“–ExecutionPolicy Bypass -File .\InstallSCOMMultiHome.ps1
After creating the package/program – distribute the content.
Now deploy the package to the servers that needs the SCOM multi-home package and once installed you should be able to confirm that the agent is properly configured.
The InstallSCOMMultiHome.ps1 Script is available here:
Download “Install SCOM Multi-Home Script” InstallSCOMMultiHome1.zip – Downloaded 380 times – 987 B
The script look like this:
<# .Synopsis This script installs and configures a SCOM agent with multi–home Please change the variables in the variables section #>
#This function adds a management group to the SCOM Agent
Param( [Parameter(Mandatory=$True)] [string]$GWServer,
[Parameter(Mandatory=$True)] [string]$MGMTGroup )
#CreateNew Object.$Object= New–Object –ComObject AgentConfigManager.MgmtSvcCfg
#Add Management Group$Object.AddManagementGroup(“$MGMTGroup“, “$GWServer“,5723)
#Restart SCOM Agent to apply the new settingsRestart–Service HEALTHSERVICE }
#Define the SCOM Management server
#Define the correcponding management group
#Define the SCOM Management server for the second server (Multi-home)
#Define the management group for server 2 (Multi-home)
#—————————————————- END OF VARIABLES SECTION—————————————————————
#Location of Installer
#Configuration of the arguments for the installer (Standard arguments for SCOM Installer)
$Arguments=“/qn USE_SETTINGS_FROM_AD=0 ACTIONS_USE_COMPUTER_ACCOUNT=1 USE_MANUALLY_SPECIFIED_SETTINGS=1 MANAGEMENT_GROUP=$ManagementGroup1 MANAGEMENT_SERVER_DNS=$SCOMMgmtServer1 AcceptEndUserLicenseAgreement=1“
#Install the agent
Start–Process–FilePath $path–ArgumentList $Arguments–PassThru | Wait–Process–Verbose
#Call AddScomManagementGroup function with variables of the second SCOM management server and group
AddSCOMManagementGroup –GWServer $SCOMMgmtServer2–MGMTGroup $ManagementGroup2–Verbose
#End of script