Automatically Displaying My Computer Icon on Desktop with Custom Name Via Script

Ever since Microsoft removed the default desktop icons which we all have been accustomed to, out of the box – its always a nuisance to have to enable them after a fresh install.  This behavior was first observed (and loathed) in Windows 7.  I generally use the icon to open up system properties, this is simply where I am accustomed to locating it….and is my preference.  This simple batch script can be called via a local GPO or domain based GPO.  It makes some minor changes to the windows registry and login.  For local use deploy it with gpedit.msc and reboot – now your my computer icon will appear with the logged in username and machine name as the title.

I like to revise things as I become aware of them….the original method I posted has become deprecated – however, it may still work on earlier versions / builds of windows 10,8,7 etc.

Revised, Currently Functional Method using VBS:

1
2
3
4
5
6
7
8
9
10
11
12
13
Set wshNetwork = WScript.CreateObject( "WScript.Network" )
strComputerName = wshNetwork.ComputerName
strusername = wshNetwork.username
Const MY_COMPUTER = &H11&
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_COMPUTER)
Set objFolderItem = objFolder.Self
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(MY_COMPUTER)
Set objFolderItem = objFolder.Self
objFolderItem.Name = strusername & " @ " &strComputerName

Deprecated method, using Batch:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
@ECHO OFF
GOTO MAIN
:MAIN
CALL :MFXN1 "HKCU"
CALL :MFXN2 "HKCU" "NewStartPanel"
CALL :MFXN2 "HKCU" "ClassicStartMenu"
GOTO END
:MFXN1
REG ADD "%~1\Software\Classes\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" /v LocalizedString /t REG_EXPAND_SZ /d "%%USERNAME%% @ %%COMPUTERNAME%%" /f
GOTO :EOF
:MFXN2
REG ADD "%~1\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\%~2" /v {20D04FE0-3AEA-1069-A2D8-08002B30309D} /t REG_DWORD /d 0 /f
GOTO :EOF
:END
ECHO.
ECHO [Process complete]

After rebooting or refreshing your current login you will see the My Computer icon on any user profile logged into the system, with the following informative information:  %username% and %computername%.  This is especially handy when working in a terminal services / rdp environment.

Lima

About the author

Lima is the visual nautical indicator for "stop instantly."

Leave a Reply