PowerShell Script to Automate Virtual Machine Provisioning using Hyper-V Version 3 Cmdlets in Windows Server 2012

PowerShell Script to Automate Virtual Machine Provisioning using Hyper-V Version 3 Cmdlets in Windows Server 2012
Hi Guys, Today i was able to fully automate the VM provisioning process Using Hyper-V Version 3 PowerShell Cmdlets Bundled with Windows Server 2012The Workflow to attain this consists of two parts

1) Creation of a sysprepped base vhd

I created a sysprepped vhd which contains of a powershell script which performs the below action

It Enables PSRemoting and also restarts the computer after renaming it to the middle word from VMName which is exactly the VM Name

In My Environment im Naming VM’s as (d.VMWIN2K8R2-1.hng)

<#PowerShell Script Placed inside Rename-Computer in c:data location in Sysprepped vhd#>


During sysprep i used an unattend xml which i created using WSIM (Windows System Image Manager) which sets the following properties

  • Enable AutoLogon,
  • Sets the Administrator Login name and also Default password
  • Set First Logon Commands to First Set Execution Policy to RemoteSigned, then Run the powershell script “Rename Computer” during first auto logon of machine which renames the host and again sets the autologon value  to “0” or false

2) Running of PowerShell Script to actually build out the VM’s

<#____________________________________________________________#>

 

Here is the Content of VMInfo1.csv.

Please follow and like us:

Share this post

One thought on “PowerShell Script to Automate Virtual Machine Provisioning using Hyper-V Version 3 Cmdlets in Windows Server 2012

  1. Hi Vinith,

    Here you are using one sysprepped VHD for all VMs. DOnt you think this will create mess when we will join these machines into domain?

    And normally we sysprepped each VHD first and then add into machine

    Prem Chugh

    Reply

Post Comment