Skip to content

Instantly share code, notes, and snippets.

View L3n1n's full-sized avatar

L3n1n

View GitHub Profile
@johnmatczak
johnmatczak / bye1drive.ps1
Last active August 1, 2026 23:39
Removes OneDrive from the system completely via Powershell on Windows 10
# Kill OneDrive completely
# https://github.com/johnmatczak
# Self-elevate the script if not already elevated
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
echo "For better results, this script should be run as administator."
$elevate = Read-Host "Would you like to elevate this script to administator? [y\N] "
if ($elevate -like 'y') {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments