Using VMM Cmdlets locally on SMA Worker Server in SMA Runbooks

If you are working with SMA and VMM you are probably familiar with the following sample Runbook for connecting to VMM:

workflow Get-VM
$VmmConnection = Get-AutomationConnection -Name ‘VmmConnection’
$VmmServerName = $VmmConnection.ComputerName 
$SecurePassword = ConvertTo-SecureString -AsPlainText -String $VmmConnection.Password -Force 
$VmmCredential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $VmmConnection.Username, $SecurePassword 
$VMMobject=Get-SCVMMServer -ComputerName $VmmServerName -Credential $VmmCredential

$VMS=Get-SCVirtualMachine -VMMServer $VmmServerName | select -Property Name

Hope this helps you when you integrate SMA and VMM.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.