SMAAuthoringToolkit.psm1
Copy-ConfigFile if ($PSIse) { $null = $PSIse.CurrentPowerShellTab.VerticalAddOnTools.Add('SMA ISE add-on', [Microsoft.SystemCenter.ServiceManagementAutomation.ISEAddOn.AutomationISEControl], $True) } <# .SYNOPSIS Get a credential asset from Service Management Automation. Part of the Service Management Automation Authoring Toolkit to help author runbooks locally. #> workflow Get-AutomationPSCredential { [OutputType([PSCredential])] param( [Parameter(Mandatory=$True)] [string] $Name ) Write-Verbose "SMAAuthoringToolkit: Looking for local credential asset with name '$Name'" $AssetValue = Get-SMAAuthoringToolkitLocalAsset -Type PSCredential -Name $Name if($AssetValue) { Write-Verbose "SMAAuthoringToolkit: Converting '$Name' asset value to a proper PSCredential" $SecurePassword = $AssetValue.Password | ConvertTo-SecureString -AsPlainText -Force $Cred = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $AssetValue.Username, $SecurePassword Write-Output $Cred } } |