Reworked Onedrive uninstaller

This commit is contained in:
Yorick Barbanneau 2018-02-22 11:22:52 +01:00
parent d79c26ee83
commit ef0bf8d492

30
cleanW10.ps1 Normal file → Executable file
View file

@ -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"