Rename Computer Vbs Script

Posted on 2012-09-21
Last Modified: 2012-10-01
I need help with a script that will remotely rename a computer that is part of Active Directory. I would like to use psexec or something that will allow me to do this without login on to the computers. They are running windows 7. Thanks a lot.
Question by:begeorge
    LVL 1

    Accepted Solution

    no script needed....

    netdom renamecomputer old-name /newname:new-name /userd:administrator

    Author Comment

    This command is great. However is there
    A way to rename multiple machines at once? Thanks in advance
    LVL 1

    Assisted Solution

    You could use powershell.

    Here is an example:
    Create a txt file with all computers and accounts (or use Excel and export to csv)


    create a powershell script:
    $computers = Import-Csv c:\scripts\computers.txt
    foreach ($c in $computers) {
    	"netdom renamecomputer $($c.OldName) /NewName:$($c.NewName) /UserD:$($c.Account)"
    	#netdom renamecomputer $($c.OldName) /NewName:$($c.NewName) /UserD:$($c.Account)

    Open in new window

    Line 1 prints out all commands (line 2 would execute them directly)
    And if you need different parameters, simply adjust your csv file.

    Another easy way is to create all commands in Excel using string concatination and auto fill.
    Copy and Paste the results to a console to execute them.

    I tried to build a small sample but unfortunately my Excel Version is german. (german commands)

    Author Comment

    Will this script prompt me for a password every time it executes line 2?
    LVL 1

    Expert Comment

    Same password for all Computers? Add it to your command line. (/PasswordD:password)

    Diffent Passwords?

    Adjust your csv file like this....


    and add one additional parameter at the end of line 2:  /PasswordD:$($.c.Password)

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Do you have users whose passwords are expiring and they are constantly calling you?  Well I sure did and needed a way to put an end to this.  We have a lot of remote users which would not be notified that their passwords were expiring since they wer…
    If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
    This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now