So i had a question yesterday about how do you change a subnet mask on a logical network that is already beeing used. Well the short answer is it can\’t be done in VMM GUI. So i decided i needed to have a look at how i could do this. Read more to see how
The first thing i tried was to do the “change” in the GUI and get the Powershell scripts. As in everything VMM it’s all Powershell, and you can get the Powershell scripts for VMM by clicking on the View Script button somewhere on the properties tab.
Now modifying this script did not work as VMM still fails to run the command on the SQL server as there are bindings to this logical networks. Wich we can see under View Dependent Resources
And as you can see i have a few dependent resources.
To work around the GUI and logic’s built in to VMM preventing me from changing this i thought, hmm perhaps i can change this in the SQL database. Be warned messing with the SQL database can cause problems. So a backup should always be done prior.
Now the subnet i wanted to change was 192.168.1.0/23 i changed this yesterday, but want to revert back to /24
So let’s open up the SQL Management Studio and dive into the SQL database and see what we can find. By going trough the tables i found one called dbo.tbl_NetMan_IPSubnet so i right clicked and clicked on Select top 1000 rows and there it was.
Now to change it we need to edit that table. We can do so by right clicking the table again and Edit Top Rows, i have 2000 as i have used this alot before. But that’s changable.
Now i can easy go in and change the Subnet and the mask on that network site.
I changed it to 24 and pressed enter and it updates the DB.
Now start the VMM service again and it will show the /24 subnet in VMM.
Now if we go back to the tables in SQL there is alot more we can change in the DB if VMM does not allow us. But do not mess with anything related to physical hosts and so on. And know what you are doing.
Also if you need to change the VLAN ID it’s the table bellow
The ID table here in IPSubnet
Is the IPSubnetID in IPSubnetVLan
VMM chains there tables with ID and refrences another table with the name of the table like IPSubnet then adds ID to it in the IPSubnetVLAN to identify the ID.
Use at own risk but remember to always take backups before changing anything in the DB