📜 VBScript (WSH)

Show This PC Icon on Desktop (VBScript)

Adds the This PC icon back to the desktop. Applies the tweak via WScript.Shell.RegWrite.

By WindowsScripting.com · 741 B
SetShowThisPCOnDesktop.vbs
' ============================================================
' SetShowThisPCOnDesktop.vbs
'
' Show This PC Icon on Desktop.
' Adds the This PC icon back to the desktop.
'
' Usage: cscript SetShowThisPCOnDesktop.vbs
' ============================================================

Option Explicit

Dim objShell
Set objShell = CreateObject("WScript.Shell")

On Error Resume Next
objShell.RegWrite "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel\{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0, "REG_DWORD"

If Err.Number = 0 Then
    WScript.Echo "Show This PC Icon on Desktop applied."
Else
    WScript.Echo "Failed to apply tweak (Error " & Err.Number & ": " & Err.Description & ")"
End If
On Error Goto 0