Jump to content

Change "My Computer" to "%username% on %computername%&q


Recommended Posts

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?

Link to comment
Share on other sites


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% /F

This 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?

Link to comment
Share on other sites

If I understand you want to change the My Computer Icon that appears in Windows Explorer.

To something like this

ChangeMyComputerIcon.jpg

Then this VBS script will do that

Save as ChangeMyComputerIcon.vbs

Const 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

Link to comment
Share on other sites

If I understand you want to change the My Computer Icon that appears in Windows Explorer.

To something like this

ChangeMyComputerIcon.jpg

Then this VBS script will do that

Save as ChangeMyComputerIcon.vbs

Const 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

Yep, 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.

Link to comment
Share on other sites

Does this do it?

@ECHO OFF &SETLOCAL
SET "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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...