Batch scripting is not dead

There’s still a little place in my heart for a decent batch script. This morsel prompts the user to enter a new computer name and then, using NETDOM, it renames the computer on the domain securely prompting for the password of an account with the required privileges. Use it in a deployment if you aren’t able or willing to use WDS’ built-in Client Naming Policy and prefer not to end up with PC-RT4T5FGR8HY or something equally ridiculous.

ECHO This computer is currently named: %COMPUTERNAME%
SET /P TARGETNAME=Enter a new computer name:
ECHO The computer will be renamed to: %TARGETNAME%
NETDOM RENAMECOMPUTER %COMPUTERNAME% /NewName:%TARGETNAME% /UserD:[Administrator] /PasswordD:* /SecurePasswordPrompt /Reboot:15

I’d love to see a PowerShell example that queries a bespoke database for a unique computer name, applies it to the computer and marks it as used in the database – a little project perhaps…?


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>