PS script to change computer name to a random one + renew DHCP lease
I have created VM templates for Windows Server OS on my ESXi environment for rapid testing purposes. But after creating a new VM from a template, I had two main problems:
- Because all VM's created from this template have same computer name, it creates conflicts.
- Sometimes I had IP conflicts as well, because all VM's created from same template still have the same IP.
So basically this Powershell script just randomises a new computer name, changes it, also renews the DHCP lease, restarts the computer and completes the staging for my environment. Simple but useful.