From ef0bf8d492501049b6360ecf1d81b2339880ef65 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Thu, 22 Feb 2018 11:22:52 +0100 Subject: [PATCH] Reworked Onedrive uninstaller --- cleanW10.ps1 | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) mode change 100644 => 100755 cleanW10.ps1 diff --git a/cleanW10.ps1 b/cleanW10.ps1 old mode 100644 new mode 100755 index bad88e3..7e12121 --- a/cleanW10.ps1 +++ b/cleanW10.ps1 @@ -183,6 +183,22 @@ function disable_shitty_service ([string]$name){ } } +# Kill a process +# Param : +# $process : name of process to kill (String) +function kill_shitty_process { + param([string]$process) + Write-Host -ForegroundColor white -NoNewLine "`tKilling $process : " + try { + $p = Get-Process $process + Stop-Process $p | Out-Null + Write-Host -ForegroundColor Green "Done" + } + catch { + Write-host -ForegroundColor Yellow "Not started" + } +} + Write-Output "`nI's time to kick ass and chew bubble gum" Write-Output "________________________________________`n" @@ -201,10 +217,11 @@ foreach ($line in Get-Content "lib\tasks.txt") {remove_shitty_tasks $line } #Remove all OneDrive Stuff thanks to https://github.com/W4RH4WK/Debloat-Windows-10/ Write-Host -ForegroundColor white "Removing all Onedrive stuff :" -Write-Host -ForegroundColor white -NoNewLine "`tKilling explorer ans OneDrive : " -taskkill.exe /F /IM "OneDrive.exe" -taskkill.exe /F /IM "explorer.exe" -Write-Host -ForegroundColor Green "Done" + +# Kill onedrive qnd explorer for proper uninstallation +kill_shitty_process "onedrive" +kill_shitty_process "explorer" + Write-Host -ForegroundColor White "`tUninstalling Onedrive" if (Test-Path "$env:systemroot\System32\OneDriveSetup.exe") { & "$env:systemroot\System32\OneDriveSetup.exe" /uninstall @@ -215,15 +232,18 @@ if (Test-Path "$env:systemroot\SysWOW64\OneDriveSetup.exe") { Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:localappdata\Microsoft\OneDrive" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:programdata\Microsoft OneDrive" Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:systemdrive\OneDriveTemp" + Write-Host -ForegroundColor White "`tModify OneDrive shitty registery values :" #OneDrive modify_shitty_reg_value "HKLM:\Software\Policies\Microsoft\Windows\OneDrive" "DisableFileSyncNGSC" 1 modify_shitty_reg_value "HKLM:\Software\Policies\Microsoft\Windows\OneDrive" "DisableFileSync" 1 modify_shitty_reg_value "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run" "OneDrive" "0300000021B9DEB396D7D001" "Binary" # Onedrive Explorer integration +New-PSDrive -PSProvider Registry -Root HKEY_CLASSES_ROOT -Name HKCR | Out-Null modify_shitty_reg_value "HKCR:\Wow6432Node\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0 modify_shitty_reg_value "HKCR:\CLSID\{018D5C66-4533-4307-9B53-224DE2ED1FE6}" "System.IsPinnedToNameSpaceTree" 0 - +Remove-PSDrive -Name HKCR +Start-Process "explorer.exe" #Advertiging... modify_shitty_reg_value "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\AdvertisingInfo" "Enabled" "0"