...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.
Hi Rob great script.
A couple of thoughts for the next version could the following please be included.
Time Zone. (Having to change it for every deployed server is a pain)
Vlan for Nic's
Language settings (Not everyone in the world is based in the USA)
would it be possible to include a custom script section so it would be possible to add in additional roles / features / commands / scripts. (This way a DC could be promoted as the first machine then the others come up 3 minutes later ?).
If interested i have all the code for the first 3.
Just a warning it seems that all computer names are created in upper case when using PDT. This means if you have in your xml file scvmm-svr1 then you will not be able to install vmm as the deploy script will add this in SCVMM and then it wont install :)
Great script, however I am seeing errors at the end of each VM creation point. I have saved the output from server10 to a text file I can send to you.
Here are the high points:
Mounting D:\VMs\Server20\Virtual Hard Disks\Server20.vhdx
D:\VMs\Server20\Virtual Hard Disks\Server20.vhdx mounted as F G:
Join domain: corp.rx8.loc
Join domain credentials: <scrubbed>
Installer service account: <scrubbed>
Organizational unit: OU=Servers,<scrubbed>,DC=loc
Out-File : Cannot find drive. A drive with the name 'F G' does not exist.
This action repeats for each time unattend.xml is attempted to be written to. Looks like $Drive is being interpreted as "F G:", so unattend.xml is not present when the VM boots.
In addition to the comments by Davey Rance, I would like to either see a Contoso DC built with the correct users & groups, or an additional file to use to populate an existing AD with the required users.
Following on Davey's comment, a separate script to create the necessary Contoso domain, or a script to create the required users/installer/service accounts in an existing domain would be a fantastic option.
Secondly, I am having an issue where the script is trying to mount the VHD for drive C as drive "F G:". This is preventing the unattend.xml file from being updated and saved to the boot drive. The error occurs starting with line 325, where it is starting to assign values to variable $Drive.
Great work on the scripts, I was finally able to complete the download of all of the files called by Downloader.ps1.
Davey - great feedback, I will certainly look at those for the next revision. As for including a DC setup in VMCreator, I showed a preview of that in my MMS 2013 session, which can be viewed here --> http://channel9.msdn.com/Events/MMS/2013/SD-B302
Davey - had not run into the case issue before, I will look into it and resolve in a future revision.
NBowman - your parent VHD has multiple partitions, which is what causes this. The post states that it must be a single partition. If you install then sysprep, you get multiple partitions. Using Convert-WindowsImage.ps1 creates a single partition parent. The next revision of VMCreator will resolve this so you can use multiple partition parents created though install then sysprep.
NBowman - the next revision will include the ability create VMs include AD and initiate an install in a single pass. I previewed this in my MMS 2013 session, which can be viewed here --> channel9.msdn.com/.../SD-B302
Thanks Rob. Using the Convert-WindowsImage.ps1 did correct my issue. The VMs created perfectly, and after editing the Variables.xml, did have them join my AD in the correct OU.
Hey Rob - Great work!
Is there a way to deploy without the use of differencing disks?
Ted - to create standalone disks instead of differencing disks, you can change "Differencing" to "Copy".
Hi Rob. Another small thing is that it seems that the orchestrator firewall rule is skipped / not added in.
But i was able to deploy out a full Private cloud environment which was just great.
Regarding the DC's i also have 3 additional files that can be added in to complete the build for Contoso.com.
Another small thing with the install of Orchestrator would it be possible to add in the runbook service account rather than just using the management account for everything.
Rob it seems that the ip address / domain join doesn't quite work when deploying out a windows 2008 R2 server.