🟣 C# / .NET 6+

Show This PC Icon on Desktop (C#)

Adds the This PC icon back to the desktop. Applies the tweak via Microsoft.Win32.Registry.

By WindowsScripting.com · 553 B
SetShowThisPCOnDesktop.cs
// SetShowThisPCOnDesktop.cs
//
// Show This PC Icon on Desktop.
// Adds the This PC icon back to the desktop.
//
// Usage: dotnet new console -o SetShowThisPCOnDesktop, replace Program.cs with this
// file, then dotnet run.

using System;
using Microsoft.Win32;

using RegistryKey key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel");
key.SetValue("{20D04FE0-3AEA-1069-A2D8-08002B30309D}", 0, RegistryValueKind.DWord);

Console.WriteLine("Show This PC Icon on Desktop applied.");