Monday, 15 December 2014

Create SLA Calendars in Service Manager 2012 R2 using PowerShell and XML

Every task I do these days, I look to automate. Even if this means doing something manually and then later going back to see if it can be.

This is probably because I work with multiple customer, with different environments, rather than just setting things up once within my own environment so this “Automate everything” approach will not apply to everyone. It’s about finding the value and ROI of spending the time designing/writing the automation versus the effort of manually doing the task.

That said, the latest one I went to tackle, was creating SLA working hours calendars within System Center 2012 R2 Service Manager (SCSM).

I had been on and off trying it for a while but picked it back up again the other week, but finally gave up banging my head on the desk (especially when I forgot to move my cup of coffee) and reached out for some help.

I sent a tearful email to my fellow SCSM Cookbook authors and Dieter Gasser, like the SCSM coding guru that he is, replied back in triple quick time with how to do this in PowerShell.
The basic outline principal for this is:
  • Gather the classes for Calendar and Working Days
  • Gather the Relationship between the two
  • Gather the Enumerations for the Days
  • Set an array for the Calendar and each Day with the Name, TimeZones, Start/End times and if they’re enabled or not
  • Create new Objects for the Class based on those arrays
  • Create the Relationships between the Days and the Calendar
  • Commit them to the database

This was so easy in the end I (as usual) had been trying to boil the ocean with a bonfire instead of taking a cup full and using a kettle.

So thanks to Didi, I was able to take his simple code which went line by line setting each day and wrapped it into a script that queries an XML file allow modelling of multiple calendars and the streamlined creation of them.

I’ve uploaded the script and example XML file to the TechNet gallery as a zip file here:

The XML is fairly self-explanatory. For each calendar you would like to create, add a <SLACalendar> </SLACalendar> section and fill in the details for the days.

If you don’t want a day as a working day, just set it as Enabled=”False”

The only part I’ve not made easier yet is the TimeZone setting.
Currently you will need to find the string value used within SCSM and copy this to the XML.

This is fairly easy to find, just create a temporary calendar with the timezone you want and then run this PowerShell one-liner to display all the timezones in use:
(Get-SCSMObject -Class (Get-SCSMClass System.Calendar$)).TimeZone

Copy and paste the output to the XML.

Once you have the XML ready, create the calendars by running the script as so:

New-SCSMCalendar.ps1 –XMLFile <Path to XML>

e.g. New-SCSMCalendar.ps1 –XMLFile C:\Temp\Calendars.xml

Again, huge thanks to Didi with his help on this, be sure to check out his blog ( or follow him on Twitter @DiGaBlog

Tuesday, 9 December 2014

What needs an Agent update in VMM?

When you apply an Update Rollup to System Center 2012 R2 Virtual Machine Manager (VMM), if you're not using plain WSUS, ConfigMgr SUS, or even the built in Update Management features of VMM, you may notice that you will see "Needs Attention" under your host status column view in the Fabric Node.

Nothing to worry about, it just means there is an agent update to push.

However, you will need to work through the fabric in the GUI, checking the Library Servers, PXE Servers, Update Servers etc etc.

You'll probably want to add the extra columns to each view of the console as you go to make it easier to check. Add these columns:
  • Agent Version
  • Agent Version Status
  • Updated Date

Or alternatively, you could always drop to a PowerShell Prompt and run this to check your entire estate very quickly:

Get-SCVMMManagedComputer | FT ComputerName,Role,VersionStateString,AgentVersion,UpdatedDate -AutoSize

This will show you the current state of your VMM Agent deployment status.

If you wanted to just see those servers requiring an update, add a filter:

Get-SCVMMManagedComputer | Where VersionState -eq UpgradeAvailable | FT ComputerName,Role,VersionStateString,AgentVersion,UpdatedDate -AutoSize

And just to finish, you "could" (I wouldn't to this on mass!!) update all of those pending agents with a couple of lines:

$Credential = Get-SCRunAsAccount | Out-GridView -PassThru

Get-SCVMMManagedComputer | Where VersionState -eq UpgradeAvailable | Update-SCVMMManagedComputer -Credential $credential -RunAsynchronously

Once run, you should see all the jobs running and then hopefully complete inside the VMM console:

See the failed one? That's the Cluster Object Name of my library file server cluster and VMM (although it shows as having an Agent Status etc) won't allow direct update of that, only the nodes that are part of the cluster.

Tuesday, 2 December 2014

Updates Galore!! But not all are equal...

Now that Microsoft are delivering updates and features at a much faster cadence, we're seeing regular updates to System Center 2012 in the form of "Update Rollups" on roughly a quarterly basis.

Update Rollups (there's a hint in the name) are an incremental set of updates, rolling up (told you) previous updates along with new updates for that release.

Currently for the 2012 R2 version we're on Update Rollup 4 (as of 02/12/14).

So after a new deployment of a System Center component, patch it to UR4 and you're ready to go, right?


You see, not all of the components always get updated with every UR, meaning that for some, UR3 might be the latest patch level even though UR4 is available.

I've pulled together the following table that shows the individual System Center 2012 R2 (I haven't pulled together the information for SP1 and if you're still on SP1, look to move to R2!)

Component UR1 UR2 UR3 UR4 Current Latest Level
SMA No Yes Yes No UR3
Orchestrator No Yes No No UR2
Service Manager No Yes Yes Yes UR4
Data Protection Manager Yes Yes Yes Yes UR4
Operations Manager Yes Yes Yes Yes UR4
Configuration Manager CU1 CU2 CU3 N/A CU3
Virtual Machine Manager Yes Yes Yes Yes UR4
App Controller No No No No RTM
Service Provider Foundation Yes Yes No Yes UR4
Windows Azure Pack WAP UR1 WAP UR2 WAP UR3 WAP UR4 WAP UR4
Service Reporting No No No Yes UR4

N.B. ConfigMgr is slightly different in that they use "Cumulative Updates" and tend to be 1 version number behind the UR's (at least for a few months).

From this table we can clearly see that the majority of the components after a new install just need UR4 applying, but in the same vein we can see that SMA & Orchestrator still need you to dig out and apply UR3 or UR2 to them.

It also shows the it wasn't until UR2 that SCSM + SMA + Orchestrator got some loving, App Controller we now know is going the way of the Dodo and Service Reporting didn't need touching until UR4.

I think what I'm trying to explain here is don't just assume you need to grab the latest patch and you're done.  Take some time to read the KB articles, see which components are updated, query your WSUS/ConfigMgr SUPs and plan appropriately.

Just for completeness, here are the latest release dates for versions of the Xplat Operating System Components:
SCOM Unix & Linux Monitoring - 28/10/2014
CM Unix & Linux Management   - 30/10/2014

And to make it easier for you, here's all the KB articles for reference:

Update KB Link
System Center 2012 R2 UR1
System Center 2012 R2 UR2
System Center 2012 R2 UR3
System Center 2012 R2 UR4
ConfigMgr Clients for Additional OS'es
SCOM  MP for UNIX & Linux OS'es

** Updated - Orchestrator is only up to UR2, Orchestrator(SMA) is UR3) **

Thursday, 30 October 2014

Microsoft Azure Operational Insights – Hyper-V Errors (EventID 1000 & 1026)

I’ve recently been trialling the next evolution of the System Center Advisor service, recently renamed to Microsoft Operational Insights.

This is an amazing evolution of the old Advisor system into an analytics tool, harnessing the power of Azure to churn through events, logs and analyse data without the need for large compute resources on premise and huge data warehouse stores.

It's also extensible through Intelligence Packs to bring new features/analysis for what matters most to your organisation and now customisable using refined searches and the "My Dashboard" feature.

It is currently free to use as it’s in preview stage and I thoroughly recommend you take a look.
Signup and more information can be found here:

You can use the service as either a standalone service by deploying the Microsoft Monitoring Agent to your servers, or by integrating into a System Center 2012 R2 Operations Manager infrastructure.
I'm using it in the integrated deployment and it was because of this that I noticed something strange.

After enabling the recently added Intelligence Pack for Change Tracking, my Hyper-V hosts in SCOM started to flip in and out of a monitored state.
When I started to dig into it, I saw the Application Event log was repeatedly logging errors (Event ID's 1000 & 1026) that the MonitoringHost.exe application was terminating unexpectedly.

Since MonitoringHost.exe is one of the key parts of the Microsoft Monitoring Agent used by SCOM, this was why the host was dropping in and out of a monitored status inside SCOM.
But what was causing it to crash?
Thankfully the Operational Insights product team came to my rescue and tracked it down with amazing speed.
I’m (as per best practice) using Server Core for my Hyper-V hosts. As part of the Change Tracking feature of OpInsights it utilises a dll call to part of the Application Experience Program Inventory Component and it turns out this isn’t installed by default on a Server Core deployment.
Microsoft are aware and will no doubt be looking for a solution but in the meantime it’s an easy workaround:
Find another server of the same OS that is non-core (i.e. has a GUI) and locate the aeinv.dll file in the %SystemRoot%\System32 directory and simply copy this across to the affected server in the same folder.

While this is a quick workaround for now, the service is still in preview so will possibly be fixed at some point and I’ll update when things change.

Also, while I experienced this with Hyper-V on Server 2012 R2, chances are this will affect other versions and roles utilising Server Core.
I also recommend checking out the superb series written by fellow MVP Stanislav around the various Intelligence Packs for Microsoft Azure Operational Insights here:

Monday, 29 September 2014

Can't reuse a computer name after cancelling a VM template deployment

We all make mistakes. I often do when deploying a VM and then deciding that I should have named it something else or given it a different setting, then cancel the deployment instead of waiting for it to finish.

I did that today when I noticed it had set the wrong display name (despite having change it!!) and when I went to redeploy it refused to pick the first number in the sequence.

N.B. if you use ## within the name during deploying via a template, SCVMM will auto increment the name of the VM based on a pattern. So Server## will become Server01 the next Server02 and so on.

There's no visible store of computer names in use/reserved etc within the console, so you will need to fall back to PowerShell to clean this up.

Sometimes when you cancel deploying a VM, a temporary VM Template is left in place and this locks the name from being reused.

Get-SCVMTemplate | Where name -like "Temp*"

This will show you all the temporary templates currently knocking around.

Then either take a note of the name and run the command again with the full name while piping it to the Remove-SCVMTemplate command, or clean up all temporary VM Templates by using:

Get-SCVMTemplate | Where name -like "Temp*" | Remove-SCVMTemplate


Tuesday, 3 June 2014

Tweak IIS for Service Manager 2012 Self Service Portal

It's been known for some time that the Self Service Portal in Service Manager can sometimes be rather slow.

This is usually when a user hasn't used it for a while (Usually seen in demo environments) and periodically it will grind for a while.

Travis blogged about some tweaks to IIS centred around the Application Pool and recycling timeouts some time back.

With the amount of scripting I've been doing lately, I thought I'd share a little snippet of PowerShell that can be used to set IIS on your SSP to tweak these settings for a bit more performance.

 NAME: Tune-SCSMPortal.ps1
 AUTHOR: Steve Beaumont
 Version: 1.0
 CREATED: 03/06/2014
 03/06/2014 1.0
 Initial Release

 Tweaks IIS settings for better performance of the System Center 2012 R2 Service Manager Self Service Portal

 Alters the configuration settings for the System Center 2012 R2 Service Manager Self Service Portal App Pool to disable periodic recycling and increase the number of worker processes

 .Parameter SCSMPortalServer
 Specify a remote server to connect to and run the tweaks.  If not specified the script will run on the local host.

 .Parameter AppPoolName
 Specify a different App Pool name to tweak. If not specified the default SCSM app name of "Service Manager Portal" will be used.

 .Parameter SiteName
 Specify a different IIS Site name to tweak. If not specified the default SCSM site name of "Service Manager Portal" will be used.


 .\Tune-SCSPortal.ps1 -SCSMPortalServer PONSCSM05

 .\Tune-SCSPortal.ps1 -SCSMPortalServer PONSCSM05 -AppPoolName "SCSM Pool"

 .\Tune-SCSPortal.ps1 -SCSMPortalServer PONSCSM05 -SiteName "Service Desk"

 .\Tune-SCSPortal.ps1 -SCSMPortalServer PONSCSM05 -AppPoolName "SCSM Pool" -SiteName "Service Desk"


Param (   
    [String]$AppPoolName="Service Manager Portal",
    [String]$SiteName="Service Manager Portal"

Invoke-Command -ComputerName $SCSMPortalServer -ScriptBlock {
 If (!(Get-Module WebAdministration)) {Import-Module WebAdministration}
    Write-Output "*Current App Pool settings*"
    Write-Output "---------------------------"
    Write-Output "Periodic Restart:"
    Get-ItemProperty -Path "IIS:\AppPools\$Using:AppPoolName" -Name Recycling.periodicRestart.time.value
    Write-Output "Idle Timeout:"
 Get-ItemProperty -Path "IIS:\AppPools\$Using:AppPoolName" -Name processModel.idleTimeout.value
    Write-Output "Max Worker Processes:"
 Get-ItemProperty -Path "IIS:\AppPools\$Using:AppPoolName" -Name processModel.maxProcesses.value
    Write-Output ""
 Write-Output "Configuring App Pool settings for better performance..."
    Set-ItemProperty -Path "IIS:\AppPools\$Using:AppPoolName" -Name Recycling.periodicRestart.time -value ([TimeSpan]::FromMinutes(0))
 Set-ItemProperty -Path "IIS:\AppPools\$Using:AppPoolName" -Name processModel.idleTimeout -value ([TimeSpan]::FromMinutes(0))
 [int]$CPU=(Get-WmiObject -namespace "root\CIMV2" -class Win32_Processor -Property NumberOfCores).NumberOfCores
 Set-ItemProperty -Path "IIS:\AppPools\$Using:AppPoolName" -Name processModel.maxProcesses -value $CPU
    Set-WebConfigurationProperty "/system.applicationHost/sites/site[@name=`"$Using:SiteName`"]" -PSPath IIS:\ -Name LogFile -Value (@{enabled=$false})

    Write-Output ""
    Write-Output "Restarting IIS"

Not the easiest to read via this blog, so I've added a more polished version to the TechNet Gallery here:

Saturday, 31 May 2014

Microsoft System Center Advisor - New version heading our way...

At TechEd North America 2014 Microsoft announced the Limited Preview of a new version of System Center Advisor.

Advisor is an online service that can be used standalone, or as an integrated option with System Center Operations Manager.

The new version has a complete overhaul of the UI and the promise of delivering new functionality via "Intelligence Packs" which can be added to your subscription to enable new features and/or display information in new ways.

You can watch the TechEd NA 2014 video on the Channel9 site here:

You can signup for the Limited Preview here:

Before you get started, check out these quick videos from the team at MS:
Advisor Preview 2min Overview Video:
Advisor Preview Onboarding Steps Video:

I'd recommend taking a look at the onboarding process before you go through the process - and if you find you're having problems getting started, be sure to checkout this common issues troubleshooting blog post from the team:

Don't forget to follow the team for news etc on their Twitter handle - @mscAdvisor

Monday, 21 April 2014

Updated 2012 R2 Orchestrator Integration Packs - Fixes ConfigMgr Console Crash

Since the release of System Center 2012 R2 there has been an issue with having the Orchestrator console, with the ConfigMgr integration pack installed, on the same system as the ConfigMgr console.

Having both of them installed would result in the ConfigMgr console crashing when trying to open it with an error similar to this:

Microsoft.ConfigurationManagement has stopped working
Problem signature:
Problem Event Name:          CLR20r3
Problem Signature 01:         LRE420M52QQYT0KWXNWESOVVMQF5I2RH
Problem Signature 02:         5.0.7804.1000
Problem Signature 03:         50adcdf1
Problem Signature 04:         System
Problem Signature 05:         4.0.30319.17929
Problem Signature 06:         4ffa5c88
Problem Signature 07:         5b0
Problem Signature 08:         19
Problem Signature 09:         N3CTRYE2KN3C34SGL4ZQYRBFTE4M13NB
OS Version:                       6.2.9200.
Locale ID:                          1033
Additional Information 1:    5861
Additional Information 2:    5861822e1919d7c014bbb064c64908b2
Additional Information 3:    dac6
Additional Information 4:    dac6c2650fa14dd558bd9f448e23afd1

This was seen previously in the SP1 release -

Thankfully the other week an updated version of the integration packs were released.

Note:  Following are the fixes in this release (4/3/2014 - v7.2.167.0):
  • The Configuration Mangager integration pack will cause the Configuration Manager Console to fail when opened.
  • The System Center Operations Manager Monitor Alerts activity can get an out of memory exception when processing a large amount of alerts.
  • The Exchange Administration activities will fail when using Exchange Online with redirection enabled.
  • The Configuration Manager Deploy Task Sequence can incorrectly set the remote client flags if you set the Download locally when needed property. This will cause the client to incorrectly evaluate it and will not run.
  • The Invoke REST Service activity was incorrectly setting the header information when using basic authentication that resulted in a 401 - Unauthorized
  • The SharePoint Integration pack will not connect sucessfully to SharePoint online if it is configured to use Active Directory Federated Services.
  • The SharePoint Integration pack Get List Items will fail to return values for column types of Choice.

Thursday, 3 April 2014

Windows Server 2012 R2 Update (April)

Microsoft announced at //Build a new update for Windows 8.1 that brings new UI features and improvements.

* Updated 08/04/14 - Required Update Changes *

Alongside this is also the fact that the same update is applicable for Windows Server 2012 R2.
The update will be available from the 8th April via Windows Update, is currently available for TechNet and MSDN subscribers and available from the 14th April for Volume Licensing customers as integrated media.

Microsoft have stated that this update will become the new service base for Windows 8.1/2012 R2 moving forwards meaning that all new updates after April will require it to be installed first.

Microsoft have being saying that as part of this update it includes previous update rollups before March, however on first boot I did a scan and found these updates as required:

Doing some further checks also shows (based on MSDN media) these following updates as offline serviced into the image:
  • KB2919442 - March servicing stack update
  • KB2919355 - Windows Update April and top level wrap for the following updates
    • KB2937220
    • KB2938772
    • KB2939471
    • KB2949621

So for a nice clean deployment based on the new Windows Server 2012 R2 Update media we presently only require 2 further updates and these two can be offline service added to the image.
Previously if you ran an update scan before the 8th April (When the April Update went GA on Windows Update) you saw some rollup updates from February and March.  This now isn't the case, but there are some further updates along side the April Update.
So now we have:
Hang on... KB2919355?? This is slightly odd since I deployed this VM using the MSDN media with KB2919355 integrated.  Looks like there must have been some last minute changes since going GA.
This doesn't include .Net 3.5 updates which are shown below but need adding after deployment due to .Net not being able to be offline serviced into an image, best done as part of creating your reference image.
  • KB2898868
  • KB2901125

Tuesday, 18 February 2014

System Center Service Manager - Here to stay!

When talking to customers over the last year or so, it's often been a pointed question that I get asked, "How serious are Microsoft about Service Manager?"

I can sometimes understand why I get asked this.  Since the initial 2012 release, Service Manager has seen relatively little in terms of new features and also very little in terms of performance and bugs fixes.

Well today, Microsoft (in a very pleasant transparent manner) have posted on their Service Manager Engineering blog a statement that shines light on the future approach for SCSM and helps show that Microsoft are not in anyway thinking about abandoning the pivotal component of the System Center stack.

You can read more here:

Thursday, 23 January 2014

Creating Service Connection Point (SCP) for Virtual Machine Manger using PowerShell

After an installation of System Center 2012 R2 Virtual Machine Manager today I was greeted at the end of the Wizard with a message that it couldn't register the SPN or SCP and to manually check them.

It's not the first time I've seen this message and rather helpfully the message directs you to run the ConfigureSCPTool.exe utility This is usually run with syntax similar to this:
"C:\Program Files\Microsoft System Center 2012 R2\Virtual Machine Manager\setup\ConfigureSCPTool.exe"  -install VMMServer.DomainFQDN DomainShort\VMMServer

However when I ran it this time, it didn't create the Service Connection Point (SCP) for me (The SPN's btw were correct already).

The SCP is important as it provides a lookup point in Active Directory for the consoles to connect to the VMM server and I also believe that Bare Metal Deployment of Hyper-V hosts use it in some form.

I could have created the SCP manually using ADSI Edit, but since I'm scripting the installs at the moment, I took 5 minutes to wrap the creation into a script.
The script can be found here:

The script basically takes an input of your Domain NetBIOS (short) name, your Domain Fully Qualified Domain Name (FQDN), your VMM Server and the service account that your VMM service runs under (I haven't tested with a local system account!).

The script when run will create the SCP object under your server computer object in Active Directory with the required Keywords, Binding Information, Class Name and DNS Info.