Show Workstation Name in Computer Icon and Start Menu (BAT)

Purpose: Show the Workstation name on Desktop and Start Menu (natively)

The case everyone is familiar with (more or less) is the case of getting a customer to tell the support personnel their computer name. This can be done with multiple different ways (tag the computer with stickers, link username and computer name in your management tool, or create something that helps the user to tell it). The way I’m going to demonstrate is suited for some cases: create something that helps the user to tell it. In this case it is going to be by renaming the “Computer” icon on the public desktop and forcing it to be shown there. This will also then rename the Start Menu “Computer”.

Requirements: SetACL.exe (http://helgeklein.com/setacl/) / included in the download
Usage: start “Configure” /wait IT_OSD_BAT_ShowWorkstationNameInMyComputer.bat
Debugging: The script must be ran as NT AUTHORITY/SYSTEM (ie. the installing force of SCCM).
Configuration: No need.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
REM *********************************************************************************
REM ** Script Name: IT_OSD_BAT_ShowWorkstationNameInMyComputer
REM ** Created on: 29.4.2013
REM ** Author: Jyri Lehtonen / http://it.peikkoluola.net
REM **
REM ** Purpose: Show the Workstation name on Desktop and Start Menu natively
REM **
REM ** License: This program is free software: you can redistribute it and/or modify
REM ** it under the terms of the GNU General Public License as published by
REM ** the Free Software Foundation, either version 3 of the License, or
REM ** (at your option) any later version.
REM **
REM ** This program is distributed in the hope that it will be useful,
REM ** but WITHOUT ANY WARRANTY; without even the implied warranty of
REM ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
REM ** GNU General Public License for more details.
REM ** 
REM ** History: 
REM ** 1.0 / Jyri Lehtonen / 29.4.2013 / Initial version.
REM **********************************************************************************
 
REM Grant SYSTEM-account (SCCM-installer) rights to modify TrustedInstaller owned registry files.
SetACL.exe -on "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -ot reg -actn setowner -ownr "n:NT AUTHORITY\SYSTEM"
SetACL.exe -on "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -ot reg -actn ace -ace "n:SYSTEM;p:full"
 
REM Force MyComputer (Computer) to be shown for all users (Public) desktop.
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" /t "REG_DWORD" /d "0" /f
 
REM Backup the old value from the registry (if you want to return it one day), and replace it with the workstation name
reg copy "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D_BACKUP}" /s /f
reg add "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" /v "LocalizedString" /t "REG_EXPAND_SZ" /d "%COMPUTERNAME%" /f
REM *********************************************************************************
REM ** Script Name: IT_OSD_BAT_ShowWorkstationNameInMyComputer
REM ** Created on: 29.4.2013
REM ** Author: Jyri Lehtonen / http://it.peikkoluola.net
REM **
REM ** Purpose: Show the Workstation name on Desktop and Start Menu natively
REM **
REM ** License: This program is free software: you can redistribute it and/or modify
REM ** it under the terms of the GNU General Public License as published by
REM ** the Free Software Foundation, either version 3 of the License, or
REM ** (at your option) any later version.
REM **
REM ** This program is distributed in the hope that it will be useful,
REM ** but WITHOUT ANY WARRANTY; without even the implied warranty of
REM ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
REM ** GNU General Public License for more details.
REM ** 
REM ** History: 
REM ** 1.0 / Jyri Lehtonen / 29.4.2013 / Initial version.
REM **********************************************************************************

REM Grant SYSTEM-account (SCCM-installer) rights to modify TrustedInstaller owned registry files.
SetACL.exe -on "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -ot reg -actn setowner -ownr "n:NT AUTHORITY\SYSTEM"
SetACL.exe -on "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -ot reg -actn ace -ace "n:SYSTEM;p:full"

REM Force MyComputer (Computer) to be shown for all users (Public) desktop.
reg add "HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" /v "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" /t "REG_DWORD" /d "0" /f

REM Backup the old value from the registry (if you want to return it one day), and replace it with the workstation name
reg copy "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D_BACKUP}" /s /f
reg add "HKCR\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" /v "LocalizedString" /t "REG_EXPAND_SZ" /d "%COMPUTERNAME%" /f

Leave a Reply

Your email address will not be published. Required fields are marked *


six + = twelve

Post Navigation