VM Deployment with PowerCLI Part Two

In my last post I presented you with the main deployment script I have been using. What it did not include are all the little tweaks and prerequisites that allow it to work.

The first thing we need before running the script is a Template. As previously mentioned, I built a vm from the corporate standard ISO. I then applied updates and added some post deployment scripts to do things we couldn’t do with NEW-VM or the customization specification.

Here are the files I used. Some consolidation could be made and your mileage may vary:

This simple .bat file is called by the customization specification. It is calling two other powershell scripts, installing sccm client and restarting the vm to finish up the installs.

The first file called is:

This file sets the SNMP properties, updated DNS servers, disables IPv6, adds domain suffixes and renames the local guest account

The next file:

This file adds our AD admin group to the local administrators group on the vm. It also renames the local Administrator account. You may notice the calling of the legal.reg file. This was needed because we have a legal message displayed after login, and it was causing us to have to interact with each vm to get it through the customization process. We disabled the legal notice in the template, and reinstate it using the registry key.

Here it is, masked for business sensitive information, of course:

Now that we have talked about all the scripts and their functions, lets move on to the last, yet very important piece: The customization specification.

I created one specifically for this build process as I needed to customize it a bit more than we were doing normally. I needed credentials with domain joining ability, the proper domain specified in the CS and adding pre.bat to the run once field.

As you can see, not terribly complicated. Definitely room for improvement. And, with the addition of some actual automation tools, could become much more powerful. This was simply my way to reduce busy work within the confines of our environment. Please feel free to use this, pick it apart or send me beer if you really liked it :)


No comments yet.

Post a Comment