🟣 C# / .NET 6+
Disable Lock Screen (C#)
Skips straight to the sign-in screen instead of showing the lock screen (requires admin). Requires an elevated (Administrator) prompt. Applies the tweak via Microsoft.Win32.Registry.
SetDisableLockScreen.cs
// SetDisableLockScreen.cs
//
// Disable Lock Screen.
// Skips straight to the sign-in screen instead of showing the lock screen (requires admin). Requires an elevated (Administrator) prompt.
//
// Usage: dotnet new console -o SetDisableLockScreen, replace Program.cs with this
// file, then dotnet run.
using System;
using Microsoft.Win32;
using RegistryKey key = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Policies\Microsoft\Windows\Personalization");
key.SetValue("NoLockScreen", 1, RegistryValueKind.DWord);
Console.WriteLine("Disable Lock Screen applied.");