One of our very good customers are managing servers with an dedicated internal administrator as a primary contact for each server. They are managing this one to one relation with an Excel sheet. A while ago we talked about automating this group creation with powershell, so the last time Jacob and I was discussing Powershell in Operations Manager we found a solution – Jacob who is the best Danish Powershell Guru of cause did a superoptimization of my first script and now its up to you to test it on your own.
Please change the first lines of the script to your environment.
Download script: [download id=”18″ format=”1″]
When I run the script it is not finding computers that are in the OpsDB. any troubleshooting tips?
Very good idea – I tried it but there are some little errors in the script. I will share it with you:
1) Check Language Settings if Excel Workbook errors occurs
2) The scripts finds no agents with this line “cd (“Monitoring:” + (get-rootmanagementserver).Principalname)”, but with this line ”
cd (“Monitoring:” + (get-rootmanagementserver).Principalname + “Microsoft.SystemCenter.AgentManagedComputerGroup”)”
unfortunatly I got another error while creating the groups:
Exception calling “InsertCustomMonitoringObjectGroup” with “1” argument(s): “Processing the template failed. See inner exception for details.”
At C:tempGroupsFromExcelSheet.ps1:166 char:40
+ $mp.InsertCustomMonitoringObjectGroup <<<< ($group)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Any idea on this?
Regards
Andy
*push*
I ran into the exact same problem where you able to solve this ?
Greetings Marc
How would one modify this script to add to an already existing group?
Got into the same problem as Marc and Andreas.
Any ideas please.
Could you please suggest for the following:
$namespace = ‘Coretech.Test’ <– I understand this is the Group Name you want to give
$opsMgrDrive = "Monitoring:ctops.coretech.intra" <—-What information should I use here related to my environment?
Thank you very much!
The article is Automate your group creation with Powershell but the linked script it group creation through Exce.
PS C:\> $mp.InsertCustomMonitoringObjectGroup($group)
Exception calling “InsertCustomMonitoringObjectGroup” with “1” argument(s): “Processing the template failed. See inner
exception for details.”
At line:1 char:38
+ $mp.InsertCustomMonitoringObjectGroup <<<< ($group)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
Poweshell Script to add bulk servers to a custom scom group