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

clip_image001[4]

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.exeExecutionPolicy Bypass -File .\InstallSCOMMultiHome.ps1

image

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.

clip_image002

The InstallSCOMMultiHome.ps1 Script is available here: [download id=”239″ format=”1″]

The script look like this:

<# .Synopsis This script installs and configures a SCOM agent with multihome Please change the variables in the variables section #>
#This function adds a management group to the SCOM Agent
function AddSCOMManagementGroup{
[CmdletBinding()]
Param( [Parameter(Mandatory=$True)] [string]$GWServer,
[Parameter(Mandatory=$True)] [string]$MGMTGroup )
#CreateNew Object.$Object= NewObject ComObject AgentConfigManager.MgmtSvcCfg
#Add Management Group$Object.AddManagementGroup($MGMTGroup, $GWServer,5723)
#Restart SCOM Agent to apply the new settingsRestartService HEALTHSERVICE }
#—————————————————-Variables section————————————————————————
#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
#—————————————————- END OF VARIABLES SECTION—————————————————————
#Location of Installer
$path=.\AMD64\MOMAgent.msi
#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
StartProcessFilePath $pathArgumentList $ArgumentsPassThru | WaitProcessVerbose
#Call AddScomManagementGroup function with variables of the second SCOM management server and group
AddSCOMManagementGroup GWServer $SCOMMgmtServer2MGMTGroup $ManagementGroup2Verbose
#End of script 

Enjoy.

/Flemming