Search This Blog

Tuesday, July 10, 2012

Change Linux Configuration in Hyper-V using Powershell

 

By default, VMM will deploy Linux VM template without OS Configuration and we are require to manually configure Linux VM setting such as computer name, ip address, dns, etc. Well, i’m not sure about you all but I'm NOT Linux expert. But luckly i found a way to achieve without going to Linux VM and make the necessary changes.

Before you read further, remember to create a Linux VM Termplate using VMM. Click here to learn on how to create Linux VM Template.

Once Linux VM has successful deployed, proceed to below step:-

0. Download SetLinuxVM Tool from http://www.setlinuxvm.com/. It is written in Powershell  by Yusuf Ozturk (MVP Powershell) and It's free.

1. First, you should allow signed Powershell scripts:

Set-ExecutionPolicy Allsigned
2. Extract file and move “SetLinuxVM” directory to “C:\Windows\System32\WindowsPowerShell\v1.0\Modules”. 

3. Remember to “Unblock” the Powershell script. To Unblock, select the powershell script, right click to select Properties and Click Unblock. Repeat this step for the entire powershell script.


3. Import as a module:
Import-Module SetLinuxVM


4.Change VM computer name to suse03.pcloud.local
set-linuxvm –vmname Suse02 –username root –Password password –Hostname suse04.pcloud.local


image


5. Change IP address
Set-LinuxVM -VMName "Suse02" Username "root" -Password "password" IPAddress "192.168.128.150" -SubnetMask "255.255.255.0" -GatewayAddress "192.168.128.150" -PrimaryDNSAddress "8.8.8.8"


image


Once you have execute the above command, you can view the process in Terminal.


image


Above is just an example which I've tested. For more setting, do visit Yusuf blog.


Nice tool to make my life simpler.