Skip to content

Instantly share code, notes, and snippets.

View liamluthor's full-sized avatar

Liam Luthor liamluthor

View GitHub Profile
# Kill OneDrive completely
# https://github.com/iamjohnm
# Self-elevate the script if required
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