Monthly Archives: January 2014

Check for failed workflow jobs in SCSM using powershell

You might have seen that SCSM uses many workflows for different things. You might wanna take a look on the status of the jobs. If you go to your administration tab and workflows -> status you will se a big list.


You can manually go into each workflow and click on the need attention or all instance tab. This is time consuming and you might only want to see what jobs has failed.



One way to get this done is using powershell. If we run the script below.

The output will be something like this below. You can now easy parse all the workflows and check for failed jobs.



Be aware that this script is pretty resource heavy. So don’t let it run all the time.

Remove broken DPM Agents with Powershell

I ran into this small problem. I had a node in my DPM and the server was removed but not from the DPM-console. Now i can’t remove it from the normal rightclick on the agents tab. As you can se the Uninstall is grayed out. I can disable the agent but thats all i can do.


It is possible to remove the broken agent with powershell. Just run the command. Just replace the DPMSERVERNAME with the name of your DPM-server and replace the DPMAGENT with the agent you want to remove.


Now the agent is removed from the console.

DPM 2012 R2 self service recovery

DPM 2012 delivers an awsome feature to allow your SQL administrators some access to the backup-system. In a normal situation you never want anyone else then the administrators of the backup-system to be allowed to do restores. But now you can allow an SQL administrator to restore a SQL database back to a specified network folder.

Many developers want the ability to restore databases in order to use them for debugging or other stuff.

Configure the user role

The first step is to configure the user role. Add a name to the role and enter a group in your domain that contains the people you want to give permissions to do a restore.


Configure the SQL-server we want to do the recovery from

Next step might confuse many people. Here we want to add the SQL-instance we want to give the users permissions to restore FROM. If you have a normal SQL-server no cluster just enter the name in the following way. SQLserver1.zgc.local\MSSQLSERVER



But there is the cache if you are using an SQL failover cluster for example. The syntax is not the same. If you don’t know what you should enter here you can watch your protection group tab in the console. If we look at the picture below. I know most is darken out but think of the path like this.



The first row Cluster Network name: SQL Server (ZGC01).zgc.local and on the second row is called SQL01\ZGC01\Master then the SQL server instance or availability group is the following.

  • SQL Server (ZGC01).zgc.local\SQL01\ZGC01 (Yes there should be spaces do not remove them)

So we have the resource group . domain name \ SQL-server \ SQL-instance. If you do this wrong you will get an error something like this.

“Enter a valid SQL Server database name. To add the entire instance of SQL Server, clear the text in the list view (ID: 32658)”


Specify recovery Target Location

On this page i just let it be as it is. I only want my SQL admins to be able to restore a database to a network folder. Not to another SQL instance.


Use the DPM Self Service Recovery Tool

Start the program and connect to your DPM-server. And now create a new recovery job and select what database and where you want it.


SCSM SendEmail solutions from 3rd party Company

For everyone that are using Service Manager you know the frustration of SCSM. I am talking about the lack of function out-of-the-box. In order to get SCSM to work “normal” most company need to invest in 3rd party solutions to achieve  their goals. This post is about a relative small application but really usefull in the day-to-day work in SCSM.

I am talking about the ability to send email from an incident or service request direct to an affected user or to someone else, add a CC or maby BCC. SCSM does not have this function naitive but i have found two company that delivers this function. Cireson does this for free and Syliance has a version of their own.


Has release an application for Service Manager that is free that allows a analyst to send email to other person then affected user. Se picture below.



Has an application for this function but this application costs money and deliver more functions. You can ass multiple attachments, search CMDB for users etc.



The email are using a template so you can customize your setup so it matches your company requirements. This was just a small thought about SCSM and 3rd party applications that can help your business become more effective.

Offline patch Virtual Machine 2012 R2 template

You might have noticed when you deploy an old template it takes long time to apply all patches that has been release after you created the template. What i have found is that there is not really any perfect way to keep your templates up-to-date.

There is two options that i have found. This is the first one. Using DISM for offline patchning of the VHD(x) files.

In my lab after i deployed a template the patch status was something like this.


Now my template of Windows 2012 R2 is kinda new so there is not many patches. But after a couple of months it will be a whole other story.

I created this small script to be able to patch a template from a repository of patches. You can use WSUS to get the patches you want or just download them from Microsofts webpage.

In the script below we have a repository of all the patches in the $wsuspath and a path to the template disk in the $vhdxpath variable.

We are using mount-diskimage cmdlet to mount the VHDx file as a system-drive. Notice in my case we are using E: but if that letter is already busy in your system another drive-letter might be used instead.

After the image is mounted we get all the updates from the repository in the $update variable and we only select files that have the file-extension .cab or .msu.

After we have selected the patches we loop throw all of them and apply them to the mounted drive using Deployment Image Servicing and Management (DISM)

In the end we dismount the image.

The output from the script should be like the text below.


After we deploy a new machine from that template it should look something like this in our WSUS-server.


In my case i missed to add a patch to the repository but you can clearly see that this template is more up-to-date then before.