Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Need a script to make this happen!

How can I script this so all users will have this regedit?

Change My Computer to the actual computer name and username. Open regedt32 and go to the HKEY_CLASSES_ROOT \CLSID{20D04FE0-3AEA-1069-A2D8-08002B30309D}
subkey. Copy the contents of the key's LocalizedString subkey (e.g., @C:\WINNT\system32\shell32.dll,-9216@1033,My Computer) to Notepad. Delete the LocalizedString subkey, then recreate it using the data type REG_EXPAND_SZ. Copy Notepad's contents into the new subkey, and change My Computer to %username% on %computername%.
0
kgbsd
Asked:
kgbsd
  • 2
1 Solution
 
PanadminCommented:
This script will change the value for Windows 2000 or Windows XP. It needs to be run on any computer you want changed.
According to http://www.winguides.com/registry/display.php/370/, Windows XP or computers with IE 6.0 should just have a new key created with the desired value. Windows 2000 is changed as you describe.

'************************************************************
dim WshShell, oldName, newName
Set WshShell = WScript.CreateObject("WScript.Shell")

oldName = WshShell.RegRead("HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\LocalizedString")
WshShell.RegWrite "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\LocalizedString.old", oldName, "REG_EXPAND_SZ"

'My Computer will be a part of the old value on Windows 2000 without IE 6.0.
if Instr(oldName, "My Computer") = 0 then
    newName = "%USERNAME% on %COMPUTERNAME%"
else
    newName = Replace(oldKey, "My Computer", "%USERNAME% on %COMPUTERNAME%")
end if

WshShell.RegWrite "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}\LocalizedString", newName, "REG_EXPAND_SZ"
'************************************************************
0
 
kgbsdAuthor Commented:
We are almost all on IE 6.  For that I have found I need to do this:

If you are using Windows XP, or if Internet Explorer 6.0 is installed, the data value of the LocalizedString Value Name should only include the variables and text that you want. DO NOT include @%SystemRoot%\system32\shell32.dll,-9216@1033, in the string.

Would I just run this script in a .bat file?
Thanks.
0
 
PanadminCommented:
Good. The script above will handle that procedure.

Save the script as RenameMyComputer.vbs (or a name of your choice ending in .vbs) and then call it from a batch file using

cscript.exe RenameMyComputer.vbs

Include the path to the VBS file if it isn't in the same folder as the batch file.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now