During migrations there is always the trouble of all those settings and things to do before everything is running smoothly.
Well during my migration I needed to move several Machines to a private cloud subscription in Azure Pack.
As I’m not the Biggest Powershell Guru I like to keep things simple and I’m a big fan of the “ select Name “ and the “ Out-GridView “
Options these options give you much more detail and make powershell a but more GUI ( don’t shoot )
#Set your SCVMM server and use -ForOnBehalfOf to make use of Service Provider Foundation.
Import-Module -Name virtualmachinemanager
$VMMSERVER = Get-SCVMMServer -ComputerName YOUR OWN VMM Server-ForOnBehalfOf
#Select WAP Cloud
$Cloud = Get-SCCloud -Name (Get-SCCloud | select Name | Out-GridView -Title "Select WAP Cloud" -PassThru).Name
#Select Select WAP User Subscription
$User = (Get-SCUserRole | Where-Object Cloud -Match $Cloud).Name | Out-GridView -PassThru -Title "Select WAP User Subscription"
# Show WAP Subscription User
$WAPUserrole = Get-SCUserRole | Where-Object Cloud -Match $Cloud | Where-Object Name -Like $User*
$WAPUserrole |ft name
# Select Single VM to WAP
$WAPVM = (Get-SCVirtualMachine ($Cloud | Get-SCVirtualMachine | select Name | Out-GridView -Title "Select Single VM to WAP" -PassThru).Name)
# show Selected VM to WAP Subscription
#Place VM in WAP Subscription
Set-SCVirtualMachine -VM $WAPVM –UserRole $WAPUserrole –Owner $User
As there is a pick list there is no typo there when moving the VM