Follow @chaderoth

Friday, December 29, 2017

How To Deploy Multiple VMs Using PowerCLI (Part 2) - Dynamic Parameters

In my previous post, "How To Deploy Multiple VMs Using PowerCLI" I showed how to script creating multiple VMs using PowerCLI and a Hash Table to track the build status. In that post I mentioned it was my first attempt at such an approach. Though this script had the potential to save someone quite a bit of time, it is actually a pretty tedious task to answer all of the questions the script prompts the user for and requires the user manually input the values needed for things like which ESXi host, Datastore, etc. to use for the VM build process.

This would likely result in an added step of the user needing to look up this information and could result in user error while mistyping information into the prompt.

While contemplating how to solve this problem I was recently introduced to parameters and using them in PowerShell to collect information from the command line and store their values into variables as part of another project I'm working on.