...building hybrid clouds that can support any device from anywhere
I introduced the PowerShell Deployment Toolkit, or PDT, in a previous post. As I mentioned in that post, PDT requires that the servers that System Center will be deployed to are already running, members of an Active Directory domain, and you have administrator permissions to those servers. PDT includes a script to help create Hyper-V VMs for this purpose – VMCreator.ps1. This post explains how to use and customize VMCreator.ps1.
VMCreator.ps1 will create any number of VMs for you on one or more standalone Hyper-V hosts. Note that the current version will not create highly available VMs on a Hyper-V cluster. VMCreator.ps1 takes input from the <VMs> section of the variable.xml file in the same folder. Under <VMs> there are two required entries – <Count> specifies how many VMs to create, and <Default> specifies the default settings for each VM to be created. Most of the entries under <Default> are fairly self-explanatory, but there are a few that need a little more detail:
If you want specific settings other than the defaults for individual VMs, such as creating specific VMs on a Hyper-V host other than the default, you can add a <VM> section at the same level as <Default>, and specify individual settings in that section. The section header must specify the VM number. All settings not specified in the <VM> section will still be used from <Default>. For example:
<VM Count="1"> <Host>otherhost</Host> < /VM>
Finally, VMCreator.ps1 must be run from a Windows Server 2012 system that has the Hyper-V PowerShell module installed.
Would it be possible to change a couple of commands instead of using Mount-VHD would it be possible to use Mount-DiskImage instead.
This is because Mount-VHD requires that the Hyper-V role is installed on a machine and not just the Hyper-V powershell tools. Mount-DiskImage is built into all windows 8 / 2012 servers so you would still have the same ability to mount the VHDX and inject the files as required but it would mean that it could be run remotely.
Thanks again :)
Davey and Rob,
I was able to edit the VMCreator.ps1 file to add in my timezone settings:
I added <TimeZone>Eastern Standard Time</TimeZone> to the following sections, right below <RegisteredOwner>:
This could become a value pulled from variable.xml in future versions.
The problem with Windows 2008 ip and domain join is because the identifier in the unattended.xml file is set to “Ethernet” and for Windows 2008 it needs to be “Local Area Connection”. So for Windows 2008 it tries to apply IP setting to an interface that doesn’t exist. I modified my variables.xml and VMCreator.ps1 so it pulls the setting form a variable.
Thanks for that DOE
I had been meaning to spend a few minutes and look at why the IP had not been applying and what had changed between 2008 / 2012 in the unattended.xml
Hi Rob. Nice presentation at TechEd 2013.
I'm trying to build the parent VHD from a Windows Server 2012 (actual disk or ISO; does not matter) and have not been able to get Convert-WindowsImage.ps1 to successfully run. It always seems to fail trying to access the \boot\bcd file on the VHD being created. Have you been able to get the script to run? If so, any examples?
Thanks in advance.
I always use Convert-WindowsImage.ps1 -ShowUI and have never had it fail. If you're having issues with it, you should probably post that against the TechNet Gallery item for Convert-WindowsImage, not PDT - we just use that tool, we don't own it.
Hi Rob. I left a query on the TechNet Gallery site on Monday, and haven't heard anything back as yet. I've tried the UI as well as the command line, and get the same problem. I also made sure the WS 2012 on which I'm running the command has all the available Windows Updates. At this point, I'm at a loss.