Add Multiple SCOM 2012 Agents to Management Group with PowerShell

I had to add multiple servers which had to be added to additional Management Group. Since I do not like mouse clicking I decided to find a script that will do the work for me.

I soon found this VBScript written by Bob Cornelissen.

Since I am a PowerShell Guy I wanted to Get-PowerShell-Script and I found Ross Worth PowerShell Script that gives us ability to add single server to Management Group.

I decided to modify the script..

This Is sample how to run my modified script:
AddSCOMAgentToManagementGroup.ps1 -AgentName “Server01″,”Server02” -ManagementGroupName “MGMTNAME” -ManagementServerName “MS01.contoso.com”

The outcome will be something like this:

Adding: Server01 to [String]$ManagementGroupName,
[String]$ManagementServerName Management Group

Or if server was already member of this management group we should get:
Agent: Server02 is Already member of: MGMTNAME

If you are constantly using same Management Server and Management group you can hard code it. Just change part:

[String]$ManagementGroupName,
[String]$ManagementServerName

to

[String]$ManagementGroupName=”MGMTNAME”,
[String]$ManagementServerName=”MS01.contoso.com”

If you will hardcode these two values you can run script:
AddSCOMAgentToManagementGroup.ps1 -AgentName “Server01″,”Server02”

Script Can be downloaded from here.

In near future I will add this also to my “Custom SCOM 2012 PowerShell Module”. So stay tuned 😉

Jure

Advertisements
This entry was posted in Operations Manager, PowerShell and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s