Sully0812 Posted April 4, 2007 Posted April 4, 2007 This is an unatended installation of Windows 2003 Server Enterprise Edition.I would like to change the label on the My Computer icon to read %username% on %computername%.I've read several different versions of this modification as a registry hack, but all involve deleting the old key and manuallycreating a new one.How can I script this in as part of my unatended install?
beaker Posted April 4, 2007 Posted April 4, 2007 This is how I'm renaming My Computer currently in a *.cmd file:REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" /V "" /D %COMPUTERNAME% /FThis is just the machine name itself, but I'm sure you could create a variable with the value of "{SPACE}on{SPACE}" and append the three items together. What have you tried so far?
gunsmokingman Posted April 4, 2007 Posted April 4, 2007 If I understand you want to change the My Computer Icon that appears in Windows Explorer.To something like thisThen this VBS script will do thatSave as ChangeMyComputerIcon.vbsConst MY_COMPUTER = &H11& Dim Folder,FolderItem, objNetwork, oShell Set objNetwork = CreateObject("Wscript.Network") Set oShell = CreateObject("Shell.Application") Set Folder = oShell.Namespace(MY_COMPUTER) Set FolderItem = Folder.Self FolderItem.Name = objNetwork.UserName & " On " & objNetwork.ComputerName
Sully0812 Posted April 5, 2007 Author Posted April 5, 2007 If I understand you want to change the My Computer Icon that appears in Windows Explorer.To something like thisThen this VBS script will do thatSave as ChangeMyComputerIcon.vbsConst MY_COMPUTER = &H11& Dim Folder,FolderItem, objNetwork, oShell Set objNetwork = CreateObject("Wscript.Network") Set oShell = CreateObject("Shell.Application") Set Folder = oShell.Namespace(MY_COMPUTER) Set FolderItem = Folder.Self FolderItem.Name = objNetwork.UserName & " On " & objNetwork.ComputerNameYep, that's exactly what I'm trying to do, but I'm trying to do it from within a batch file (for political reasons here at the office.)Beaker's code in the previous post works perfectly for just the machine name, but I'm having difficulty getting the entire string in there, and having the registry entry use %computername% instead of the value it reflects.
Yzöwl Posted April 6, 2007 Posted April 6, 2007 Does this do it?@ECHO OFF &SETLOCALSET "RKEY=HKLM\SOFTWARE\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}"SET "KDAT=%%USERNAME%% on %%COMPUTERNAME%%"REG ADD %RKEY% /VE /T REG_EXPAND_SZ /D "%KDAT%" /F>NUL
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now