PowerCli. Automate VM deployment with static IP and some others customization.

Recently I’ve been requested to deploy plenty of virtual machines with static IP address and custom password. These VMs should not be controlled by our IT department so I cannot use tools like Config Manager.
I decided to write a custom PowerShell function and share with you. My script require you to be connected to the vcenter with PowerCli module as well as required permission to deploy VM.
You can add forEach loop and pass a CSV file to run script.

Some parameters will be checked prior VM creation, such as:
Datastore Name
VM name, if name already exsist
Resource pool and folder (folder will be created if script won’t find one)
VM cluster if exsist
Provided disk capacity must be greater that source VM

Here is the script:

You should see progress in on your console, here is how it looks like:

You can grab script here.

Feel free to add more functionality if you want or make some piece of code more effective.
This script works with one disk and one network adapter, so you can add these features and of course one good thing is RunOnce that VmWare supports in their PowerCli modeule you should’t forget about.

Keep scripting.