Archive for: ‘February 2011’

Creating recurring Change Requests

February 11, 2011 Posted by Anders Asp

There was a question on the official forum on how one would be able to create recurring Change Requests (http://social.technet.microsoft.com/Forums/en-US/systemcenterservicemanager/thread/3f9f08ce-c331-43cf-b22c-2fe43da1440d/). So I figured that it might be a good idea to create a blog post on how to achive this.

In this blogpost, we are going to use the authoring tool to create a new custom workflow that runs a powershell script to create a new change request (with a template) on a pre-defined schedule.

To be able to do what’s decribed in this post, you will need to download and “install” the latest version of SmLets: http://smlets.codeplex.com/

Step 1 – Create a Change Request template

  1. Start your SCSM console and go to Library -> Templates.
  2. Click Create template in the task pane.
  3. Enter a name, description and choose to target the Change Request class. We’ll also have to decide where we want to save this template. I’ll chose to create a new MP to save the whole solution/blogpost within.
  4. When pressing Ok the template will be displayed in design mode. Enter the appropiate information and remember to add atleast one activity.
  5. Oki, so now when the template is finished, we need to export the MP in which it was stored. To do this, go to Administration -> Management Packs and locate the MP. Mark it and then click Export in the task pane.

Step 2 – Create the workflow

  1. Start the Authoring Tool and open the MP we just exported from SCSM and in which our template is stored.
  2. In the Management Pack Explorer, right click Workflows and select Create.
  3. Enter a good name and description.
  4. At the next page of the wizard, we’ll have to enter a workflow run condition. The defualt value “Run at scheduled time or at scheduled intervals” suits us perfectly.
  5. Enter on what days of the week and at what time you want the workflow to run. Then click your way through the rest of the wizard.
  6. An empty workflow should now be displayed in the authoring tool. Let’s add a script activity to this workflow, so something happens when it’s triggered. Do this by dragging the Windows Powershell Script activity from the Activities Toolbox to the workflow.
  7. Next we will have to define the properties of the Powershell activity. This is done by marking the activity and then locating the Script Body in the Details pane. When marking the Script Body, a “…” button will appear. Click that button.
  8. A dialog box named Configure a Script Activity should appear and in that box there should be a line that says “View or Edit Script”. Click that line to show the field in which we can add our Powershell script.
  9. Copy this Powershell script and paste into the Script body of the activity.
  10. Import-Module Smlets
    
    $CrClass = Get-SCSMClass -name System.WorkItem.ChangeRequest$
    $Params = @{
    ID="CR{0}"
    Title="Recurring CR: " + [datetime]::now
    }
    
    $o = New-SCSMObject -Class $CrClass -PropertyHashtable $Params -pass
    
    $title = $o.Id
    $changeRequest = Get-SCSMObjectProjection System.WorkItem.ChangeRequestProjection -filter "Id -eq '$title'"
    
    $template = get-scsmobjecttemplate standard.*change
    
    $changeRequest.__base.ApplyTemplate($template)
    $changeRequest.__base.Commit()
    

    Like this:

  11. Before we press Ok, there is (atleast) one thing we need to edit first, and that is the $template. In step 1 we created a template that we wanted to use in this workflow, and to be able to use that, we need to find out the ID of that template. In order to do that, we need to open the MP/XML file in which it is stored.Locate your MP and open it with an XML editor (notepad should be fine). Now do a search for the name of your template, until you find a display string for it. In that display string, an ElementID should be defined. Copy that ID (without the ” ” characters).
  12. Now, replace the ‘standard.*change’ text in your powershell script with this ID, like this:
  13. Press Ok to close the dialog box and then hit the Save All button in the authoring tool.
  14. Along with our updated MP, the authoring tool should now have created a couple of files. One of them should be a DLL file which needs to be copied to the installation directory of SCSM (by default: C:\Program Files\Microsoft System Center\Service Manager 2010). After you’ve copied the DLL into place, open the SCSM console and import the MP (Administration -> Management Packs).

Now a CR should be created every time your schedule starts the workflow!

Thanks to Jim Truher who helped me with the Powershell syntax for applying a template!

Export all unsealed management packs

February 8, 2011 Posted by Anders Asp

Here’s a little powershell script that I use for exporting all unsealed MPs. It’s really useful to run once in a while so you have a backup of all unsealed MPs.

The script will create a new folder with the current date and store all MPs in that folder. Change the $OutPutDir variable to a folder of your choice.

Add-PSSnapin SMCMDLetSnapIn

$OutPutDir = "C:\Unsealed MPs\"

$UnsealedMPs = Get-SCSMManagementPack | ?{ ! $_.Sealed }

$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToShortDateString()
$CompletePath = ($OutPutDir + $CurrentDate)

if ( ! (test-path  $CompletePath))
{
    $output = New-Item -Type Directory -Name $CurrentDate -Path $OutPutDir
}

$UnsealedMPs | %{
    "   Exporting: {0}" -f $_.Name 
    $_ | Export-SCSMManagementPack -directory "$CompletePath"
    }

Cumulative Update 1 for SCSM SP1 just released

February 3, 2011 Posted by Anders Asp

The Cumulative Update 1 for Service Manager Sp1 were just released and contains the following fixes:

  • Extending a large-volume class hangs the console indefinitely
  • Adding 25th child item on a list results in an error
  • DW data loss for relationship fact tables with properties

Download it here:
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=82954fe2-2168-42cd-8456-762730ac37eb&utm_source=feedburner&utm_medium=twitter&utm_campaign=Feed%3A+MicrosoftDownloadCenter+%28Microsoft+Download+Center%29#tm

I’ll install it as soon as possible and report any issues with it here.

Update: The installation went smoothly and no issues were discovered. The installation should only be performed on the Mgmt. and DW server.
Read more here: http://support.microsoft.com/?kbid=2484853

Extend the Software Item class with licensing information

February 3, 2011 Posted by Anders Asp

Some customer wants to keep track on how certain software are licensed, and one way to do that will be described here.

We will extend the Software item class with a list property, populate that list with some values and create a view based upon that licensing information.

  1. Start your Authoring tool and create a new Management Pack (MP). I’ll name my MP ExtensionOfSoftwareItem.xml
  2. Locate the Class Browser and search for Software Items (If the list is empty, hit the refresh/reload content button first). Right click the Software Items class and choose View.
  3. The sealed MP in which the original Software items class is stored will be loaded in the authoring tool. Next we will have to right click the Software Items class and select Extend class.
  4. A dialogue asking in which MP we want to store our customizations will appear. Press Ok to save it in the MP we just created.
  5. Now we have came to the step where we do the actual extension, so let’s hit the Create Property button.
  6. Enter a good name for our new property and press Create. I’ll name mine SoftwareLicense.
  7. The new property which we just added will be of the default Data Type string. What we would like to do, is creating a list of different licensing models, and in order to do that, we need to change the Data Type to List. So press the dropdown meny labeled Data Type in the Details window and select list. (You might need to press the enter key after you’ve selected List)
  8. A new dialogue box will appear in which all existing lists will be presented. But since our list doesn’t exist, we need to create a new one. So press the Create List… button.
  9. Enter a Internal name, a display name and a description and press Create followed by Ok.
  10. That’s actually all we need to do in the Authoring Tool. If the Software items class would have it’s own form, we could have edited that form to place our new list where we wanted it, but since it’s based upon the generic form, we won’t need to do that. So let’s save our MP and import it into Service Manager. (To import the MP, go to Administration -> Management Packs in the SCSM console and use the import task on your right hand side)
  11. After the MP has been imported, our new list should appear under Library -> Lists. So let’s go there and add a few licensing models.
  12. Now let’s go to the All Software view in the Configuration Items wunderbar. Locate a software CI of your choice and open it. The form should now have additional field named Software License.
  13. So you are now able to assign a software license form for all your applications, great. But if you would like to see all your Software Items in a fast and easy way, we would need to create a view for that. So let’s do that as well.Right click on the folder on your left hand side named Software and select Create view, or click the task on your right hand side that is named the same.
  14. Give the view an appropriate name and scroll down to the Criteria section. The default class here will be Configuration Item, so let’s change that to Software Items instead. Do that by pressing the Browse button. In this dialogue box, we will have to change the view to “All basic classes” first. Then we can do a search for Software Items. When you have located Software Items class, mark it and press ok.
  15. Now we can select the criteria for this view. Leave the Object status does not equal Pending delete as it is, but mark Software Licens in the list and press Add. A new row should appear in the Criteria box below. Let’s edit that so it says Software License Equals Freeware.
  16. The last and final step of creating the view, is to select which information the view should display. In this example I’ll just choose Display Name, Software license and Time added. After you’ve selected which columns to display, press Ok.
  17. Your new view should now be created and should only view the Software items in which we have spcified the Software license as Freeware.

To sum up: We extended the Software Items class in the Autoring Tool with a property of the type list. We then added some items to this list and created a view based on on of those values. This is a pretty common task for anyone working with Service Manager, and with the help of the Authoring tool it is an easy thing to do.

Notify the assigned analyst when a customer has updated his incident (Exchange connector)

February 1, 2011 Posted by Anders Asp


******* Update ********

Please take a look at this post as well.
http://www.scsm.se/?p=564
***********************

Often when a incident is created with the Exchange Connector, it lacks some vital information that the customer forgot to write in his/her’s email. The analysts will therefore use the Send email task that was provided together with the Exchange Connector to request more information. And because of the lack of information, the analyst can’t start working with the incident. Therefore it’s important to notify the analyst when the customer has updated the incident with the required information so he/she can start working with it as soon as possible.

Note: This blogpost assumes that you have installed and configured the Exchange connector and the Send Email task. For more information regarding this, see the official blogpost:
http://blogs.technet.com/b/servicemanager/archive/2011/01/13/exchange-connector-released.aspx

To do this, we will create a workflow that will trigger on the incident status, and send an email to the assigned analyst once it changes from one value to another.

  1. To start with, we need to create some incident templates. One of these will be applied when the analysts use the Send Email task, and the other will be used once the incident is updated by the Exchange Connector.
    Navigate to Library -> Templates in the SCSM console.
  2. Click the Create template task and enter the information needed. When you press Ok the template form will be displayed.
    Create template
  3. The only thing we want to configure in this template, is the incident status. This can be done by using the task “Change Incident Status” and choosing a incident status. In this post I will be using the status Pending. However, it might be a good idea to use a custom status if you have other workflows tied to Pending.  If you want to use a custom status, you can add that to the Incident Status list (Library -> Lists -> Incident Status).
    Change Incident Status task Set status to Pending
  4. Now, repeat step 2 and 3 again, but this time create a template that sets the status to Active.Note: If you have a template that you use when the Exchange Connector updates a incident and you want to maintain that information, you will have to edit that template to also set the status to Active.
  5. We should now have two templates to use when the different workflows are triggered. The next step will be to edit all your workflows related to the Send Email task that does require input from the customer to apply the “Set incident status to Pending” template when being triggered. (For instance, you might have a Send Email template to inform your customer. On those workflows, this template should not be applied.)
    To do this, go to Administration -> Workflows -> Configuration -> Incident Event Workflow configuration. Locate the workflows that needs to be edited and open them one at a time to edit. Then go to the Select Incident Template part of the form and choose to apply the template we created.
    Editing our workflow related to the Send Email task
  6. So whenever we use a Send Email that is bound to this workflow, it will send the notification/request to the customer, but it will also update the status of the incident to Pending. Great! Next, we will have to go to our Exchange connector, and change the “Incident template to apply when incidents are updated” setting. Here we will be using our template that changes the status to Active. (Remember the note in step 4!)
    (Administration -> Connectors. Double click your Exchange connector to edit)
    Edit the Exchange Connector
  7. Now, go ahead and create a Notification template to use when the customer has updated the incident. (Administration -> Notifications -> Templates. Use the Create E-mail template task)
  8. The last thing we need to do now, is creating a workflow that will notify the assigned analyst whenever the incident status changes from Pending to Active. So let’s go back to our workflows and create a new workflow that does this. (Administration -> Workflows -> Configuration -> Incident Event Workflow configuration. Then press Add.)
    – Enter an appropriate name and description, trigger when the incident is updated and save it in a management pack of your choice.
    – Set the Changed From criteria to Incident status Equals Pending and the Changed To criteria to Incident status Equals Active.
    – Skip the Apply template part (unless you would like to do that)
    – In the Select user to notify, select to notify the Assigned to user and the template of your choice. Remember to press Add 🙂
    – Complete the wizard by pressing Next followed by Finish and Close.
    Changed from criteriaChanged to criteria
  9. And we are Done! It might be a good idea to try some different scenarios together with a colleague to make sure it works as expect.