• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Remotely rename PCs?

thirdeye

Platinum Member
I'm not sure that this is even possible but it would be nice to do since I have a bunch of workstations that don't adhere to a common naming scheme. Is there a command/tool that would facilitate this action without me having to go to each and every machine and kick the user, log in, change the name, then reboot?

Any insight would be appreciated. As a disclaimer if it involves scripting, you'll have to pretty much spell it out, since I'm not overly familiar with scripting yet.
 
vbscript

renaming requires a reboot, so even if you script it, the box has to reboot before the name change happens
this code works with xp and server 2003, it may or may not work with windows 2000, i am not sure
Set oShell = WScript.createObject("WScript.shell")
Set WshNetwork = WScript.CreateObject("WScript.Network")
strOldName = WshNetwork.ComputerName
strComputer = "."
strNewName = "NewComputerName"
'this renames the computer
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(strNewName)
Select Case err
Case "0"
WScript.Echo "Success!"
Case Else
WScript.Echo "Failure!"
WScript.Quit
End Select
Next
'this reboots the computer
strComputer = strOldName
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Shutdown)}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
ObjOperatingSystem.Reboot()
Next
WScript.Quit
 
Ok, I figured out how to get it to rename my local machine. What would I have to do in order for it to look at another machine on my network named testpc01 and change it to jsmith?
 
you have to run the script on that computer

i don't know of any remote way to do that. if you have a remote way to run scripts (like logon scripts if you are on a domain), then you can use that
 
Back
Top