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

    Help with renaming PC

    IT Discussion
    4
    8
    348
    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.
    • S
      siringo
      last edited by

      Hoping someone can help me out with this.

      I need to rename a bunch of PCs & want to use a simple script.

      I found this:

      *@ECHO OFF

      set PC=NEW_PC_NAME

      wmic path win32_computersystem where "Name='%computername%'" CALL rename name='%PC%'*

      I've not tested it yet, but is there a way I can make the script prompt me to enter the new PC name???

      Or any other way I can achieve this???

      Thanks for any help.

      1 Reply Last reply Reply Quote 0
      • J
        JaredBusch
        last edited by

        Use powershell

        Rename-Computer -NewName somename
        
        D 1 Reply Last reply Reply Quote 5
        • H
          hobbit666
          last edited by hobbit666

          I use this when setting up new machines

          $ServiceTAG = "PC-$((Get-WmiObject Win32_BIOS).serialnumber)"
          $OLDNAME = (Get-WmiObject win32_COMPUTERSYSTEM).Name
          Rename-Computer -ComputerName $OLDNAME -NewName $ServiceTAG -force

           $ServiceTAG = "PC-$((Get-WmiObject Win32_BIOS).serialnumber)"
                  $OLDNAME = (Get-WmiObject win32_COMPUTERSYSTEM).Name
                  Rename-Computer -ComputerName $OLDNAME -NewName $ServiceTAG -force
          
          
          S 1 Reply Last reply Reply Quote 3
          • D
            Dashrender @JaredBusch
            last edited by

            @jaredbusch said in Help with renaming PC:

            Use powershell

            Rename-Computer -NewName somename
            

            It could easily take you longer to find a script than just type this command on each machine.

            S 1 Reply Last reply Reply Quote 1
            • S
              siringo @Dashrender
              last edited by

              @dashrender said in Help with renaming PC:

              @jaredbusch said in Help with renaming PC:

              Use powershell

              Rename-Computer -NewName somename
              

              It could easily take you longer to find a script than just type this command on each machine.

              I agree.

              Just trying to find a quick way to change the PC name and add to a domain.

              The domain name has 32 characters in it.

              1 Reply Last reply Reply Quote 0
              • S
                siringo
                last edited by

                thanks for all help so far.

                can anyone help me with a way in which I can add a PC description via command line/powershell etc?

                I'm trying to remove the need for typing as I stuff up more things than get right.

                I can create a unique PC name from the above, so I've deceide if I can add a useful common description to each PC I can then identify them via the description field.

                S 1 Reply Last reply Reply Quote 0
                • S
                  siringo @siringo
                  last edited by

                  @siringo Thought I'd add this for others may be looking:

                  $value = @{Description = 'My own gaming computer'}
                  Set-CimInstance -Query 'Select * From Win32_OperatingSystem' -Property $value

                  1 Reply Last reply Reply Quote 0
                  • S
                    siringo @hobbit666
                    last edited by

                    @hobbit666 said in Help with renaming PC:

                    I use this when setting up new machines

                    $ServiceTAG = "PC-$((Get-WmiObject Win32_BIOS).serialnumber)"
                    $OLDNAME = (Get-WmiObject win32_COMPUTERSYSTEM).Name
                    Rename-Computer -ComputerName $OLDNAME -NewName $ServiceTAG -force

                     $ServiceTAG = "PC-$((Get-WmiObject Win32_BIOS).serialnumber)"
                            $OLDNAME = (Get-WmiObject win32_COMPUTERSYSTEM).Name
                            Rename-Computer -ComputerName $OLDNAME -NewName $ServiceTAG -force
                    
                    

                    this was a great help, thank you @hobbit666 . I changed it to this:

                    "B311-$("$env:computername$(get-random)")"
                    $OLDNAME = (Get-WmiObject win32_COMPUTERSYSTEM).Name
                    Rename-Computer -ComputerName $OLDNAME -NewName $ServiceTAG -force -restart

                    As the netbios names were displaying as the same.

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