diff --git a/cleanW10.ps1 b/cleanW10.ps1 index bd52524..bcd583d 100755 --- a/cleanW10.ps1 +++ b/cleanW10.ps1 @@ -113,6 +113,33 @@ function modify_shitty_reg_value { Write-host -ForegroundColor Green "done" } +# Delete a reg key +# Params : +# path : the complete path to reg key +# key : key name +function delete_shitty_reg_key { + param([string]$path, [string]$key) + Write-Host -NoNewline "`tDelete key $key reg : " + if (!(Test-Path $path)){ + Write-Host -ForegroundColor Red -NoNewline "path not found" + return + } + + try { + Remove-ItemProperty -Path $path -Name $key + } + catch [System.Security.SecurityException]{ + Write-Host -ForegroundColor Red "access denied" + return + } + catch { + Write-Host -ForegroundColor Red "error" + Write-Host "`t$Error[0]" + return + } + Write-host -ForegroundColor Green "done" +} + # Function to remove shitty prog from shitty win # Params : # $name : Feature name @@ -255,6 +282,12 @@ Remove-PSDrive -Name HKCR Get-ScheduledTask -TaskPath '\' -TaskName 'OneDrive*' -ea SilentlyContinue | foreach { remove_shitty_tasks $_ } + +reg load "hku\Default" "C:\Users\Default\NTUSER.DAT" | Out-Null +New-PSDrive -PSProvider Registry -Root HKEY_USERS -Name HKU | Out-Null +delete_shitty_reg_key "HKU:\Default\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" "OneDriveSetup" +Remove-PSDrive -Name HKU +reg unload "hku\Default" | Out-Null Start-Process "explorer.exe" #Advertiging...