Bulk AD computer rename

Renames AD computers en-mass using a csv file as the source.
The CSV file needs to be in the format of:

Old Name,New Name

You can use these as headers in the file, or not, it's up to you.
Once the script has run once, it will add columns for:

Contactable, Result, Error

after the New Name column

When you run the script, it will check you have PowerShell V4.
Provided you do then it will prompt for an admin account - must have the ability to change AD details and admin rights over the other machine.
You then get asked if you want to force all successfully renamed machines to reboot immediately.
N.B. If you don't rename immediately then should the end use lock their machine before rebooting, they could be locked out of the machine until a reboot is completed...

It then checks the connectivity of the machine and if successful, tries to rename the machine.

The script will write the results back to the source file (the data is overwritten) with any error code returned.

You can then run the script again using the same source file and it will skip any which were successful the previous attempt - these machines will then not be listed in the file once the script has run.

There is a chance that you may rename some incorrect machines should your DNS not be 100% up to date so if doing a lot it would be worth removing stale DNS entries and checking the results afterwards.

Source Code

This script has not been checked by Spiceworks. Please understand the risks before using it.