ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Renaming a Windows Computer from the Command Line

    IT Discussion
    windows windows server windows desktop powershell command line rename-computer sam windows administration hostname netbios netbios name
    3
    10
    2.9k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by scottalanmiller

      Windows includes a very handy PowerShell commandlet for renaming a computer. The most simple form is to rename the local machine, rarely would we want to rename a remote one although that is supported as well. After renaming a machine, a reboot is necessary for the change to take effect.

      Rename-Computer myservername
      Restart-Computer
      

      That's it. When the computer comes back up, it will have the new Hostname and NetBIOS name.


      An alternative restart command would be:

       shutdown /r /c "Renamed Machine"
      
      1 Reply Last reply Reply Quote 5
      • thwrT
        thwr
        last edited by

        Oh, you can do that even on remote machines, either by Enter-PSSession or Invoke-* or by using Rename-Computer's -ComputerName parameter

        1 Reply Last reply Reply Quote 0
        • thwrT
          thwr
          last edited by

          And btw, you are using a PowerShell command in the first place, why not rebooting that machine using a PowerShell cmdlet in this case?

          Restart-Computer -Force -Timeout 0
          
          scottalanmillerS 1 Reply Last reply Reply Quote 1
          • scottalanmillerS
            scottalanmiller @thwr
            last edited by

            @thwr updated to reflect

            thwrT 1 Reply Last reply Reply Quote 1
            • thwrT
              thwr @scottalanmiller
              last edited by

              @scottalanmiller Oh, cool. Just thought it would make more sense

              1 Reply Last reply Reply Quote 0
              • IRJI
                IRJ
                last edited by

                I learned something new today. I have been using the shutdown command for years. I never realized you could rename a PC with it.

                scottalanmillerS 1 Reply Last reply Reply Quote 0
                • scottalanmillerS
                  scottalanmiller @IRJ
                  last edited by

                  @IRJ said in Renaming a Windows Computer from the Command Line:

                  I learned something new today. I have been using the shutdown command for years. I never realized you could rename a PC with it.

                  shutdown doesn't do the renaming, you just have to reboot after you rename.

                  IRJI 1 Reply Last reply Reply Quote 0
                  • IRJI
                    IRJ @scottalanmiller
                    last edited by

                    @scottalanmiller said in Renaming a Windows Computer from the Command Line:

                    @IRJ said in Renaming a Windows Computer from the Command Line:

                    I learned something new today. I have been using the shutdown command for years. I never realized you could rename a PC with it.

                    shutdown doesn't do the renaming, you just have to reboot after you rename.

                    I use "m" instead of c for computer name

                    scottalanmillerS 1 Reply Last reply Reply Quote 0
                    • scottalanmillerS
                      scottalanmiller @IRJ
                      last edited by

                      @IRJ said in Renaming a Windows Computer from the Command Line:

                      @scottalanmiller said in Renaming a Windows Computer from the Command Line:

                      @IRJ said in Renaming a Windows Computer from the Command Line:

                      I learned something new today. I have been using the shutdown command for years. I never realized you could rename a PC with it.

                      shutdown doesn't do the renaming, you just have to reboot after you rename.

                      I use "m" instead of c for computer name

                      /c is the comment for the logs to tell them that you just "Renamed Machine", it doesn't rename it, it literally puts "Renamed Machine" into the reboot logs.

                      IRJI 1 Reply Last reply Reply Quote 0
                      • IRJI
                        IRJ @scottalanmiller
                        last edited by

                        @scottalanmiller said in Renaming a Windows Computer from the Command Line:

                        @IRJ said in Renaming a Windows Computer from the Command Line:

                        @scottalanmiller said in Renaming a Windows Computer from the Command Line:

                        @IRJ said in Renaming a Windows Computer from the Command Line:

                        I learned something new today. I have been using the shutdown command for years. I never realized you could rename a PC with it.

                        shutdown doesn't do the renaming, you just have to reboot after you rename.

                        I use "m" instead of c for computer name

                        /c is the comment for the logs to tell them that you just "Renamed Machine", it doesn't rename it, it literally puts "Renamed Machine" into the reboot logs.

                        Ok. Got ya.

                        1 Reply Last reply Reply Quote 1
                        • 1 / 1
                        • First post
                          Last post