Starting and waiting for an SMA runbook from remote computers

If you are going to manually trigger a SMA runbook from a single computer you’ll want to install the Powershell module from the Orchestrator setup splash screen by clicking on PowerShell administration under Service Management.

However in order to deploy this to a team of administrators we’ll want to automate this. According to the technet library we should be able to use the command:

msiexec.exe /i PowershellModuleInstaller.msi /qn

We can get this PowershellModuleInstaller.msi file from the System Center 2012 R2 Orchestrator 2012 R2 iso in the SMA subfolder.

Continue reading


SMA – Time to Execution Performance

The following TechNet blog post from the Orchestrator team can be used for measuring stress and load performance of your SMA environment: Configure SMA for Optimum Performance

This got me wondering what other ways I could improve performance. I noticed one key area in my scripts was the time while the script was in the “starting” phase. We know that SMA compiles the workflows at run time…so that was my target area.
Continue reading

Passing Hashtables to Start-SMARunbook as a Parameter

In this post, we are going to explore using hashtables as parameters in an SMA workflow. I’ll let the code do most of the talking this time.

Consider the following SMA runbook:

workflow DEV_MDTestArea

Continue reading

Catching Password Complexity Errors from Set-ADAccountPassword within SMA

Most of the time, I’d like to figure out complete solution before publishing a blog post. There are times however where an error doesn’t make sense to me…..this is one of those times.

    $inSecNewPassword = "Password"
    $secNewPassword = ConvertTo-SecureString -String $inSecNewPassword -AsPlainText -Force 
    #Try set password
    Set-ADAccountPassword -Identity $strClientUser -NewPassword $secNewPassword -Confirm:$false -reset -ErrorAction Stop
}Catch [Exception]{
        "Password doesn't meet complexity requirements"

This code works as expected in native powershell….
This code also works as expected in a PS Workflow….
This code does NOT work in a Service Management Automation PS Workflow.
Continue reading

Draining a SMA Runbook Worker from its Jobs

There are times (say when installing Windows Updates) where it would be beneficial to reboot a SMA Worker. Within the SMA gui, there is no way for you to easily tell if the server is currently taking on new jobs, if it is currently running any jobs, or if it is taking on new jobs.

You will want to come up with some sort of process so you can keep your SMA Workers up to date. Here is what we like to do:

1. Remove the SMA Runbook Worker from the deployment.
2. Check for any running runbooks or wait the configured drain time (default 900) seconds
3. Reboot the SMA Runbook Worker
4. Add the SMA Runbook Worker to the deployment
Continue reading

SMA – Calling child runbooks from other child runbooks launched from a foreach -parallel loop may not return reliable results

Consider the following 3 runbooks: A:

workflow DEV_MDTestArea
    $i = 0
        $Tests = @("vm-md-srv2008r2","sma-imagetest1")
        ForEach -Parallel ($Test in $Tests){
           DEV_MDTestArea2 -Computer $Test
    }While($i -lt 20)

Continue reading

Restart-Computer acts differently in child SMA runbooks

You should already be aware that Powershell -ne Powershell Workflows. The language is largely transferable, but there is some tweaking that you will need to do. (See: here)

Today, I have realized that there are similar quirks with child workflows vs parent workflows in SMA (Service Management Automation)
Continue reading