Microsoft SMA – Exporting Samples

SMA and nothing but SMA!

So running SMA instance without the ‘Azure Pack’ makes using SMA is a bit more … exciting!

After nosing around i saw that there were several “Sample-” runbooks already built for us in SMA, most of these focused on integrations with other systems…

RunbookName
Sample-Using-VMCloud-Automation
Sample-Using-Activities
Sample-Managing-WebSiteCloud
Sample-Using-Variables
Sample-Managing-Orchestrator
Sample-Managing-VirtualMachineManager
Sample-Using-Credentials
Sample-Using-SuspendWorkflow
Sample-Managing-MySqlServers
Sample-Managing-ConfigurationManager
Sample-Using-Modules
Sample-Using-Connections
Sample-Using-Runbooks
Sample-Managing-OperationsManager
Sample-Managing-Plans
Sample-Managing-UserAccounts
Sample-Managing-Azure
Sample-Deleting-VMCloud-Subscription
Sample-Modify-VMCloud-Subscription
Sample-Using-Checkpoints
Sample-Managing-VMClouds
Sample-Using-RunbookParameters
Sample-Managing-ServiceBusCloud
Sample-Managing-DataProtectionManager

I am looking at doing some integration in ‘SMA’ to ‘Configuration Manager 2012’ and I noticed there were sample Runbooks for ‘Configuration Manager’. Now without the Azure Pack’ viewing these Runbooks was a little more difecult, espeially having to understand the states a Runbook can be in (Published, Draft etc..) to be able to view it.

I wrote this quick script to export the “Sample-” Runbooks for better viewing.

Note: the destination directory must exist. “D:\SMA\Runbooks\Samples\”

$parameters = @{'WebServiceEndpoint' = 'https://server.domain.com','Port' = 9090}
$Runbooks = Get-SmaRunbook @parameters | Where{$_.RunbookName -like '*Sample-*'} | Select RunbookName
$Runbooks | %{$scriptPath = "D:\SMA\Runbooks\Samples\$($_.RunbookName).ps1"; Out-File -InputObject (Get-SMARunbookDefinition @parameters -Name $($_.RunbookName) -Type Draft).Content -FilePath $scriptPath -Force}

 
Hope this helps.

All information is provided on an AS-IS basis, with no warranties and confers no rights.

One Reply to “Microsoft SMA – Exporting Samples”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s