A couple of month ago Microsoft released the latest (updated) version of PowerShell 5.0 . Why is this worth writing about? Well, with every new release there are some fantastic goodies included, you just need to discover them :). One of these goodies is (my) long awaited runbook editing capability for ISE. In this post I would like to show you how to get it installed and how to work with it.
First we need to get the module which is called SMAAuthoringToolkit. Because my lab environment does not have internet access, I will just download the module to my notebook and copy it to the lab machine.
Save-Module SMAAuthoringToolkit -Path C:\Temp
This command will save the module from the PowerShell Gallery in C:\Temp…
Next, I copy the module to the lab server to my user path C:\Users\[user]\Documents\WindowsPowerShell\Modules…
Next type…
Install-SMAIseAddOn
This will install the add-on so that it will be automatically loaded next time you start your ISE.
If you have internet connection on your system you don’t need to do the above “offline” copy steps, instead you just need to type…
Install-Module SMAAuthoringToolkit -Scope CurrentUser
If you add the -Scope CurrentUser parameter, the module is installed to…
$env:USERPROFILE\Documents\WindowsPowerShell\Modules
Then, if you want the PowerShell ISE to always automatically load the add-on, run…
Install-SMAIseAddOn
Otherwise, whenever you want to load the add-on, just run the following in the PowerShell ISE…
Import-Module SMAAuthoringToolkit
No let’s start ISE and see what we got…
Because I installed the add-on on my runbook worker I just click Sign In and my Windows account will be used to connect to SMA. Otherwise you need to set the connection User Name / Password and URL to your SMA web service. Awesome! If you click Browse you are able to select where you want to cache your runbooks locally. If you are wondering, which certificate is used for encrypting your local assets you can figure this out easily…
As you can see it is in your personal local certificate store. Next let’s check the Runbook tab….
All your runbooks will be listed and you are able to Download these locally for editing purposes and then uploading again. Of course you can Create New runbook and then upload it to SMA, because SMA 2016 will also support native PowerShell scripts for runbooks, you also have the option to create a Script runbook. One cool functionality is, that you are able to test the draft and if ok publishing it to SMA…
In the Assets tab you get all Assets, by category you want like Variable, Credentials etc. Of course you are also able to create, delete, edit and download / upload Assets…
If you are wondering where this stuff get’s stored, you can find the runbooks and Assets in your defined AutomationWorkspace, which is in my case here C:\Users\[user]\AutomationWorkspace
As you can see there are two *.json files (SecureLocalAssets.json and LocalAssets.json) which keep the secure Assets (e.g. credentials, encrypted variable) and the unencrypted Assets stored.
Note: I am really thrilled to have this new add-on finally available. It will make my life a lot easier writing runbooks for SMA. As you might know, there is also an add-on for Azure Automation available. The functionality is pretty much the same. If you need more details about Azure Automation add-on check out my post. I hope this helps!
This has made updating running your scripts for Azure Automation even better. Nice Writeup Stefan
Thank you 🙂
Saved my ass after an OS upgrade to 2016.. Thanks!