For sometime now Microsoft have had a blog entry on the Service Manager blog for adding holidays to a SCSM calendar and walks you through the steps on how to create this. This works really well and saves a huge amount of time. However, I have found myself having to keep recreating this each time I complete a new install for a customer and so to save myself even more time I have attached the CSV required for the UK and have removed the unnecessary entries such as ‘Battle of the Boyne’ etc. The problem with this is that the CSV (attached here) also contains the unique GUID for the SCSM calendar from the environment I created it from. You will need to update this GUID within the CSV otherwise when you import it you will end up with a new calendar that does not work. It’s the first column in the CSV file holds the calendar and the easiest way to update this is to get the ID of your calendar and use the replace function of notepad (or your XML editor of choice). To get the ID (a high level overview):
- Using PowerShell import the module SMLets
- Get the Calendar object using the ‘Get-Object’ command specify the calendar class.
- Use the format list command to expose the ID
To get the ID (with a bit more detail):
- You will need to import the SMLets PowerShell commandlets using “Import-Module SMLets”
- To get the calendar run the command “Get-SCSMObject -Class (Get-SCSMClass -Name “System.Calendar$”) | fl”
- Copy the ID attribute including the “SLACalendar_”
- Using Notepad do a find and replace to replace the existing calendar with the one you just found with the PowerShell command.
- Use the XML file provided by the Microsoft blog post and the CSV file you just updated.
There you have it a really quick way to populate the holidays into an existing SCSM calendar :)