+ Post New Thread
Results 1 to 1 of 1
Scripts Thread, Rename a computer remotely in Coding and Web Development; I have posted this in the blogs as well. I thought i would put it here as well, sometimes users ...
  1. #1

    FN-GM's Avatar
    Join Date
    Jun 2007
    Thank Post
    Thanked 1,802 Times in 1,551 Posts
    Blog Entries
    Rep Power

    Rename a computer remotely

    I have posted this in the blogs as well. I thought i would put it here as well, sometimes users miss things in the blog.

    From time to time we need to rename computers on the domain. The computers can sometimes be in a locked room, in a remote site or you simply cant be bothered visiting them.

    This code below will allow you to rename computers on the domain form the comfort of your own desk. Once you have entered you old name and your new name the computer concerned will automatically reboot and your all done! All you have to do is make sure nobody is using the machine and that the new computer name is available in AD.

    If you are still running Windows XP you will have to install the Windows XP Support Tools. If you are on Vista or Windows 7 nothing additional is required.

    Just copy the below code into a notepad file. Set the username and password of an account with appropriate permissions, then save the file as a .vbs then your good to go! Just run the new file and you will see prompts for the new name and the old name.

    'On Error Resume Next
    'open the file system object
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    set WSHShell = wscript.createObject("wscript.shell")
    Dim sNewCname     'Variable to hold Computer Name you enter in the inputbox
    Dim sOldCname        'computers current name
    'First param is message text, second is message title
    sOldCname = InputBox("Enter computers current name","Computer Rename Utility")
    sNewCname = InputBox("Enter computers new name","Computer Rename Utility")
    Call WSHShell.Run("cmd.exe /K netdom renamecomputer " & sOldCname & " /newname:" & sNewCname & " /userd:DOMAIN\USER /passwordd:PASSWORD /usero:DOMAIN\USER /passwordo:PASSWORD /force /reboot:5 ")

  2. Thanks to FN-GM from:

    pooley (5th February 2012)

+ Post New Thread

Similar Threads

  1. scanning a computer remotely for spyware?
    By fafster in forum How do you do....it?
    Replies: 0
    Last Post: 14th June 2010, 04:01 PM
  2. Rename a computer while on the domain
    By msnriggs in forum Scripts
    Replies: 0
    Last Post: 20th January 2010, 07:21 AM
  3. Rename My Computer Via Registry
    By FN-GM in forum Windows 7
    Replies: 10
    Last Post: 14th September 2009, 09:43 PM
  4. Shutting Down computers remotely
    By marvin in forum Windows
    Replies: 27
    Last Post: 23rd February 2009, 11:01 AM
  5. Deleting or renaming "My Computer"
    By Benji1 in forum Windows
    Replies: 4
    Last Post: 8th July 2006, 09:39 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts