locked
I need script for change the name of computers in domain RRS feed

  • Question

  • Hi!!!

    I need a script that makes me change the name of some computers that are already owned and wings are remote locations which can only access via psexec.
    Any idea?.
    Thank you.
    Saturday, June 6, 2009 12:37 PM

Answers

  • Renames a computer and its corresponding Active Directory computer account. Requires Windows XP or Windows Server 2003, and must be run on the local computer.

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set colComputers = objWMIService.ExecQuery _
        ("Select * from Win32_ComputerSystem")

    For Each objComputer in colComputers
        err = objComputer.Rename("WebServer")
    Next
    • Proposed as answer by Shuvava Monday, June 15, 2009 8:44 AM
    • Marked as answer by Andrew Willett Monday, July 27, 2009 7:52 AM
    Monday, June 15, 2009 8:41 AM

All replies

  • Hi, Try using this Script (or at least some of its functionalities) http://assaf.miron.googlepages.com/changecomputerip,nameandjointodomain.vbs
    Assaf Miron http://Assaf.Miron.googlepages.com
    Saturday, June 6, 2009 2:59 PM
  • Hi, thanks for the script, but only I need to change the name of the computer and do not have very much knowledge of vbs. Is it necessary to to eliminate first the computer of the domain, change name and then it return to the domain?, or it is not necessary and in spite of to changing the name and the sid is sufficient?, does any exist example?

    THANK YOU!!

     

    Monday, June 8, 2009 6:36 AM
  • Renames a computer and its corresponding Active Directory computer account. Requires Windows XP or Windows Server 2003, and must be run on the local computer.

    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    Set colComputers = objWMIService.ExecQuery _
        ("Select * from Win32_ComputerSystem")

    For Each objComputer in colComputers
        err = objComputer.Rename("WebServer")
    Next
    • Proposed as answer by Shuvava Monday, June 15, 2009 8:44 AM
    • Marked as answer by Andrew Willett Monday, July 27, 2009 7:52 AM
    Monday, June 15, 2009 8:41 AM