Switching dynamic IP to static in VMM

Creating a VM from virtual disk or existing virtual machine is a basic task in every VMM infrastructure. What if you want to assign IP from static pool instead of dynamic which is just the one option by default for such deployments? Well,doing this in wizard, will end by receiving a warning:“You cannot customize IP settings for a stored virtual machine or a virtual hard disk. You can only customize IP settings if you use a VM template” and static IP pool will be grayed out.

vmm static ip pool greyed out

If you don’t want to create VM template for some reason, PowerShell will help you to fix this behavior. Just start VM creation wizard, edit hardware and other settings and leave Dynamic IP for network adapter. Then don’t run VM and execute the following PowerShell script:

#Get VM
$vm=Get-SCVirtualMachine -Name "rl-srv-01.demolab.com"

#Get static pool which you are going to use with that VM (here I'm filtering pool by address range)
$pool=Get-SCStaticIPAddressPool|? {$_.IPAddressRangeStart -eq ""}

#Grant changes
Grant-SCIPAddress -GrantToObjectType "VirtualNetworkAdapter" -GrantToObjectID $vm.VirtualNetworkAdapters[0].ID -StaticIPAddressPool $pool

#Update network adapter settings
Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $vm.VirtualNetworkAdapters[0] -IPv4AddressType static

Go back to the VM settings and check changes that script has successfully made:

vmm dynamic to static ip pool result

TOTD: How to turn off VMM Console auto-connect

Hi, folks!

Here is the new tip of the day with a little trick inside that can save your time.

VMM Console has an ability to auto logon to the selected VMM server with predefined credentials. It works like a charm and is a really useful feature.
But if you have more than 1 role in VMM (for instance, you are assigned to 2 different roles/tenants and don’t have a global administrator rights) auto-connect can cause some inconveniences during connection.

VMM console settings are located in registry (HKCU hive)  and with auto-logon enabled console uses the last role/VMM server address as targets.
To connect to another instance and cloud (or in some other cases) we need to turn off auto-connection (‘cause VMM won’t show you drop-list with assigned roles as available for choosing).

Unfortunately, you cannot change this behavior from GUI (VMM starts connection without any timeouts on it’s execution)..but PowerShell and registry can help us. Update: see the comment from Michiel 🙂

To quickly revert auto-connect settings back to default just run these lines from PS:

#Path for AutoConnect string key
$path='HKCU:\Software\Microsoft\Microsoft System Center Virtual Machine Manager Administrator Con

#Turns off AutoConnect in VMM Console
Set-ItemProperty -Path $path -Name AutoConnect -Value $false

Note: administrator rights are not required

Gallery :

%d bloggers like this: