Automate your group creation with Powershell

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: zip Group Creation Powershell 28.49 kB
Downloaded 545 times





3 Responses to “Automate your group creation with Powershell”

  1. Scott says:

    When I run the script it is not finding computers that are in the OpsDB. any troubleshooting tips?

  2. 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:\temp\GroupsFromExcelSheet.ps1:166 char:40
    + $mp.InsertCustomMonitoringObjectGroup <<<< ($group)
    + CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException

    Any idea on this?

    Regards
    Andy

  3. Fe Gremmels says:

    This might not be the most beneficial place to inquire about this, but I’m searching for a pest management company inside the pittsburgh region and have no way to find out who is the very best. I discovered this company that is really close to me and wanted to see if anyone has any critiques on them. Spectrum Pest Control, 3058 West Liberty Avenue, Dormont, PA 15216 – (412) 446-2802

Leave a Reply