pass parameter values to Invoke-CMScript

The Invoke-CMScript cmdlet invokes a PowerShell script in Microsoft System Center Configuration Manager. System Center Configuration Manager has an integrated ability to run Powershell scripts. The scripts simplify building custom tools to administer software and let you accomplish mundane tasks quickly, allowing you to get large jobs done more easily and more consistently. For more information, see Create and run PowerShell scripts from the Configuration Manager console.

unfortunately the Invoke-CMScript doesn’t allow to pass values to defined  script params. if you want to do this, you have to invoke the script through the Configuration Manager console. read more

daily Backup Report for SC DPM

i like System Center Dataprotection Manager, especially for the backup possibilites of remote Windows servers and the Online backup to Azure. But in my past, i lost the overview about succeded and failed backup jobs. The included reporting doesn’t helped me enough, and the alert notification was like spam. I needed a daily report with one view of all Jobs, Disks, Agents and other states. To reach this goal, i wrote my own PowerShell script, which i want to share here.

the report, sent by mail will look like this:

SC DPM daily report

the code for this is here:

 

 

document your SCOM 2012 environment

This is quite huge for me, because I’ve been working on this script for the last two months and finally decided, to release the script to public, although I know that it’s still far from complete.

Document your Operations Manager 2012 environment

You should know your environment and what happens in it and you should be able to show people what exactly has been configured in your environment. This is quite important for consultants, but also for admins. Consultants need to create a documentation after implementing Operations Manager 2012 at a costumer’s site and admins should be able to know how their environment looks like at any given time.

Usually people ‘only’ document the most important stuff or what they think is the most important stuff. Every documentation looks different and my believe is that it shouldn’t be that way. I’d like to have my documentations all look the same, no matter where I create them.

Like automation, I like standardization. That’s why, i created a PowerShell script for create my “SCOM 2012 configuration Report”.

Here is a preview of the report:

SCOM configuration report

Powershell cmdlets for Operations Manager 2012

Before I started to write this script I asked myself if I wanted to use WMI only or also the OM12 native cmdlets for Powershell. Both Technologies have their own Advantages and disadvantages.

This is a script that will ONLY get you information, it won’t change anything in your environment, that’s why I decided to use the Powershell cmdlets wherever possible and to avoid using WMI.

Version 0.1

I rate this script at version 0.1, because there are still some things missing. They will be added in time.

Maybee you will find some problems. tell me and I will try to correct them.

Requirements

In order to run this script the following requirements have to be met:

  • Microsoft System Center 2012 Configuration Manager SP1 (at least)
  • Powershell 3.0
  • installed Operations Manager Admin GUI
  • read-access to the RMS
  • read-Access to all involved SCOM servers
  • Microsoft Word (best with an English installation)

How to execute the script

I added a comment-based help to the script, so you shouldn’t have any problems running it, but here’s one way to execute the script:

Thanks

Thanks also to David, which gives me the idea of this script and has also a wonderful Inventory Script for SCCM here.

I’m hoping for lots of feedback on this script, because I can’t possibly test everything in my demo lab. So if you find an error or have issues with this script, please tell me!

Download the script here:

SCOM-configuration-report-v0.1.0.zip size: 22.8 kB, counter: 1042, updated: 11. April 2014

demoted Domain Controller still present in SCOM

If you demote a Domain Controller, SCOM will generate a lot of alerts. By design, there is no automatically undiscovery for the Rules and Monitores for the Active Directory Roles.

Solution 1

This solution will remove all disabled Class instances from an existing object. it will not change any other properties of the object.

  • Open the Operations Management Shell
  • type in this command:

  • Stop the System Center Management service
  • Delete the folder C:\Program Files\System Center Operations Manager\Agent\Health Service State
  • Start the System Center Management service

Solution 2

This solution will clear only the agent cache. Sometime this will be sufficient, if the server discovery / undiscovery was already done well:

  • Stop the System Center Management service
  • Delete the folder C:\Program Files\System Center Operations Manager\Agent\Health Service State
  • Start the System Center Management service

Solution 3

This solution will remove the entire object and then recreate the object with it’s discovery. The new object wouldn’t be discovered as Domain Controller. The new object will have an new guid and any overwrites to the old object will be lost.

  • Stop the System Center Management service
  • Delete the folder C:\Program Files\System Center Operations Manager\Agent\Health Service State
  • Open the SCOM console
    • go to Administration → Agent Managed
    • delete the affected server
    • use the Discovery Wizard to redeploy the agent to the affected server
    • read more

  • extend the Active Directory Users class for SCSM

    Today I needed some additional fields for the Active Directory User class for an SCSM Service Offering. For example, I need the PrimarySmtpAddress, which exists in the AD as mail, but not in the SCSM class. in this post, I will describe, how I did it:

    We will need:

    • System Center Service Manager 2012 SP1
    • System Center Orchestrator 2012 SP 1
    • Service Manager Authoring Tool
    • Strong name key file

    Open the Service Manager Authoring Tool and click to the menu File New, to create a new Management Pack. Define a unique name for your management packs file name, in this Example: Josh.Test.Library.xml (Library mean’s that we will extend a library class)

    in the Class browser, select All Management Packs and search for the Domain User or Group class. if you expand this class, you will see the mail field, but it wouldn’t be accessibly (for example in your service requests). right click it and select View:

    2014-02-07_15-05-37

     Now you will see the Domain User and Group class in the Management Pack Explorer. Right click it and select Extend class:

    2014-02-07_15-11-35

    select your new Management Pack and click OK:

    2014-02-07_15-15-14

    now, you will see the new class, give it an unique name. normally I dont’t use special chars, spaces or dots for the new name:

    2014-02-07_15-19-05

    on some versions of the Authoring Tool, it will automatically create a new property, like Property_26. select the row and then click to the delete icon

    2014-02-07_15-24-01

    now you can add new properties. The new Property should have a unique internal name for your complete Service Manage environment ! normaly I use the Management Pack Name as a prefix for the Property internal name.

    2014-02-07_15-36-13

    After creating the property, you can change some property details, like the (display-)Name, Data Type, etc:

    2014-02-07_15-39-34

    Now you can save the Management Pack and build a sealed one. To seal your Management Pack, you will need a strong name key file. How you can create a strong name key file, is described here (thank you Marcel). right click the management pack and select Seal Management Pack:

    2014-02-07_15-48-57

    Choose the output directory and the key-file to use:

    2014-02-07_15-53-44

    Now, you can import the new management pack like every time.

    After importing, you will see the new field in the Extension tab of your Active Directory User CI:

    2014-02-14_12-52-49

    In the next step, you should import datas from Active Directory to the newly created Extensions using an Orchestrator Runbook. Your runbook should have this activities:

    • Get User activity from Active Directory
    • Get Object activity from SC 2012 Service Manager
      • select the newly created class
      • filter by UPN equals {User Principal Name from “Get User”}

      Update Object activity from SC 2012 Service Manager

    • select the newly created class
    • Object Guid = {SC Object Guid from “Get Object”}
    • add a field: PrimarySmtpAddress → {Email from “Get User”}
    • read more

    delete orphaned computers from SCOM

    after renaming a Active Directory computer, the computer was automatically detected in SCOM with the correct new name. but after short time, I detected, that the originally agent was already there, but not reachable. so I deleted the old computer under Device Management – Agent Managed.

    normally after maximum 3 days, the agent isn’t visible in the computer view. the delay of 3 days is by design. so don’t delete the computer manually to early.

    If you still see the Computer showing up – even after 3 days – then in most cases, there is still a discovery associated with it. To find the discovery, use this query:

    in my case, I didn’t found any discovery for this computer and it was still available in the Windows Computer view one week after deletion of the agent.

    so I found a solution

    ***THE FOLLOWING PROCEDURE IS NOT SUPPORTED BY MICROSOFT***

    we need to check the database with this query for the orphaned entities:

    now we will mark this old entries as deleted:

    after this, make a refresh in your SCOM console. the orphaned Windows Computer shouldn’t be there anymore.

    Create SCOM Dashboard for SharePoint in Visio

    This week I created a DashBoard for SCOM in Visio to present it on a SharePoint site. Normally you could use the Visio 2010 Addin for SystemCenter – Operations Manager. But this addin has some special prerequisites for the presentation on the SharePoint site, like installing SCOM components and special configurations on the SharePoint Farm. Also it has the limitation, that it can only present monitor states, and can’t present rule values (for example: disk usage).

    So I created my own solution, which I will describe here. An overview to the steps: read more

    SCOM 2012 agent communication issue

    This days, I had a very special problem with some new SCOM agents. I installed some new servers and installed the SCOM 2012 agent on it. But after some time, they appeared in the Agent Managed view, still as not monitored.

    first I looked up the event logs on the new servers and found this errors:

    06-01-2014 07-57-40

    06-01-2014 07-58-04

    According to this errors, I found a lot of blogs about network and certificate issues, like this one: http://geertbaeten.wordpress.com/2013/07/08/scom-agent-or-gateway-certificate-issue/

    but I don’t have a Certificate authority and I also assumed not have a network problem.

    after a lot of search, I find out, that the SCOM Root Management Server it self was in maintenance mode. as soon I changed this, all my new agents connected successfully-

     

    new SNMP simulation tool

    In the last time i have a lot to do with creating and testing SNMP monitors in our monitoring system. Rather than being surprised when a SNMP monitor doesn’t work correctly, i would like to test my newly created monitors against a SNMP simulation tool.

    So i was looking for an SNMP simulating tool. But the only ones i could found, are to expensive for me or not useable.

    Cause of this, i started to develope my own SNMP simulation tool running on Windows system.

    The currently planed features are:

    • MIB Browser
    • Record values from a life Agent (walk an Hardware agent and log it)
    • Simulate different agent simultanous
    • Log SNMP request received by the tool and answeers from the tool to your monitoring system
    • Change values of OID’s manualy to test monitoring systems when incorrect values are submitted
    • Change values of OID’s automaticaly by predifined rules / tasks
    • Support for SNMP v1, v2 and v3

    Let me now, which feature you would like in an SNMP simulation tool.

    Collect warranty informations with SCCM

    a few days ago my boss liked to see a list of all our computers with the warranty informations like purchase date and warranty end date. So i wrote this little vbscript, witch collect the information from the manufacturers webpage (in our case HP, Dell and Maxdata) and write it to a MIF file.

    Please have a look at the script or download it here:

    After using this vbscript on each client computer you can create a SCCM report to list the warranty informations.