Help with renaming PC
-
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.
-
Use powershell
Rename-Computer -NewName somename
-
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
-
@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.
-
@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.
-
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.
-
@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 -
@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 -restartAs the netbios names were displaying as the same.