From 4debcb2e3640143f491e26e1022ec9dd34555299 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Thu, 22 Feb 2018 12:39:09 +0100 Subject: [PATCH] Reworked text output --- cleanW10.ps1 | 56 ++++++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/cleanW10.ps1 b/cleanW10.ps1 index 47e7a9b..2c11687 100755 --- a/cleanW10.ps1 +++ b/cleanW10.ps1 @@ -9,7 +9,7 @@ $ErrorActionPreference = "SilentlyContinue" function block_shitty_host { param([string]$filename, [string]$ip, [string]$hostname) remove-host $filename $hostname - Write-Host -NoNewline -ForegroundColor White "Block host $hostname : " + Write-Host -NoNewline "`t$hostname :" try { if ( ! $(is_host_present $filename $hostname) ){ $ip + "`t`t" + $hostname | Out-File -encoding ASCII -append $filename @@ -41,7 +41,7 @@ function is_host_present { function block_shitty_ip { param($ip) - Write-Host -ForegroundColor white -NoNewline "Blacklist IP $ip : " + Write-Host -NoNewline "`t$ip : " if ( Get-NetFirewallRule -Name Blacklist_$ip -ErrorAction SilentlyContinue) { Write-Host -ForegroundColor Yellow "already blacklisted" return @@ -61,7 +61,7 @@ function block_shitty_ip { function remove_shitty_tasks () { param($taskList) Foreach ($task in $taskList){ - Write-Host -ForegroundColor white -NoNewline "Remove Task $task : " + Write-Host -NoNewline "`t$task : " if ($PSVersionTable.PSVersion.Major -gt 2) { if (Get-ScheduledTask -TaskName $task -ErrorAction SilentlyContinue) { Write-Host -NoNewline -ForegroundColor DarkGreen "found! " @@ -75,7 +75,7 @@ function remove_shitty_tasks () { else { Write-Host -ForegroundColor Yellow "already removed"} } else { - Write-Host -Nonewline -ForegroundColor Red "damned! this is not Windows 10!" + Write-Host -ForegroundColor Red "damned! this is not Windows 10!" } } } @@ -89,7 +89,7 @@ function modify_shitty_reg_value { param([string]$path, [string]$key, [string]$value, [string]$type) Write-Host -NoNewline "`t$key reg key to $value : " if (!(Test-Path $path)){ - Write-Host -ForegroundColor Gray -NoNewline "creating path " + Write-Host -NoNewline "creating path " New-Item -Path $path -Force | Out-Null } @@ -118,7 +118,7 @@ function modify_shitty_reg_value { # $name : Feature name function disable_shitty_feature { param ($name) - Write-Host -NoNewline -ForegroundColor White "Disable $name feature : " + Write-Host -NoNewline "`t$name : " $requestInstall = dism /online /Get-FeatureInfo /FeatureName:$name /English $isInstalled = $requestInstall | Select-String "state" If ($isInstalled -match "Enable") { @@ -141,7 +141,7 @@ function disable_shitty_feature { # $pkg : Package (Object) function remove_shitty_modern_app { param($pkg) - Write-Host -ForegroundColor white -NoNewLine "Remove $($pkg.Name) modern app : " + Write-Host -NoNewLine "$($pkg.Name) :" try { $pkg | Remove-AppxPackage } @@ -155,7 +155,7 @@ function remove_shitty_modern_app { function remove_provisioned_shitty_modern_app { param($pkg) - Write-Host -ForegroundColor white -NoNewline "remove provisioned $($pkg.DisplayName) : " + Write-Host -NoNewline "`t$($pkg.DisplayName) : " try { $pkg | Remove-AppxProvisionedPackage -Online | Out-Null } @@ -168,10 +168,10 @@ function remove_provisioned_shitty_modern_app { } function disable_shitty_service ([string]$name){ - Write-Host -ForegroundColor White -NoNewline "Disable service $name : " + Write-Host -NoNewline "`t$name : " $serv = Get-Service -name $name if ( !$serv) { - Write-Host -ForegroundColor Red "not found " + Write-Host -ForegroundColor Red "not found" return } if ( $serv.StartType -eq "Disable") { @@ -188,7 +188,7 @@ function disable_shitty_service ([string]$name){ # $process : name of process to kill (String) function kill_shitty_process { param([string]$process) - Write-Host -ForegroundColor white -NoNewLine "`tKilling $process : " + Write-Host -NoNewLine "`tKilling $process : " try { $p = Get-Process $process Stop-Process $p | Out-Null @@ -202,13 +202,21 @@ function kill_shitty_process { Write-Output "`nI's time to kick ass and chew bubble gum" Write-Output "________________________________________`n" +Write-Host -ForegroundColor White "Blacklist hosts :" foreach ($line in Get-Content "lib\hosts.txt"){ block_shitty_host $HOST_FILE $HOST_IP $line } +Write-Host -ForegroundColor White "`nBlacklist IPs :" foreach ($line in Get-Content "lib\ip.txt"){ block_shitty_ip $line } +Write-Host -ForegroundColor White "`nDisable features :" foreach ($line in Get-Content "lib\features.txt"){ disable_shitty_feature $line } +Write-Host -ForegroundColor White "`nDisable services :" foreach ($line in Get-Content "lib\services.txt") { disable_shitty_featureService $line } + +Write-Host -ForegroundColor White "`nRemove modern apps :" Get-AppxPackage -AllUsers | Where-Object { $_.name -in $(Get-Content "lib\apps.txt")} | foreach { remove_shitty_modern_app $_ } + +Write-Host -ForegroundColor White "`nRemove provisioned modern apps :" Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -in $(Get-Content "lib\apps.txt")} | foreach { remove_provisioned_shitty_modern_app $_ } @@ -216,13 +224,13 @@ Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -in $(Get-Con 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 "`nRemoving all Onedrive stuff :" # Kill onedrive qnd explorer for proper uninstallation kill_shitty_process "onedrive" kill_shitty_process "explorer" -Write-Host -ForegroundColor White "`tUninstalling Onedrive" +Write-Host "`tUninstalling Onedrive" if (Test-Path "$env:systemroot\System32\OneDriveSetup.exe") { & "$env:systemroot\System32\OneDriveSetup.exe" /uninstall } @@ -233,7 +241,7 @@ Remove-Item -Recurse -Force -ErrorAction SilentlyContinue "$env:localappdata\Mic 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 :" +Write-Host "`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 @@ -246,25 +254,25 @@ Remove-PSDrive -Name HKCR Start-Process "explorer.exe" #Advertiging... -Write-Host -ForegroundColor White "Disable Advertising :" +Write-Host -ForegroundColor White "`nDisable Advertising :" modify_shitty_reg_value "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\AdvertisingInfo" "Enabled" "0" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AdvertisingInfo" "DisabledByGroupPolicy" 1 # Geoloc. -Write-Host -ForegroundColor White "Disable Geolocalization :" +Write-Host -ForegroundColor White "`nDisable Geolocalization :" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" "DisableLocation" 1 modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" "DisableLocationScripting" 1 modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\LocationAndSensors" "DisableWindowsLocationProvider" 1 #smartscreen filter -Write-Host -ForegroundColor White "Disable Smartscreen filter :" +Write-Host -ForegroundColor White "`nDisable Smartscreen filter :" modify_shitty_reg_value "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost" "EnableWebContentEvaluation" # AllowTelemetry -Write-Host -ForegroundColor White "Disable Telemetry :" +Write-Host -ForegroundColor White "`nDisable Telemetry :" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\DataCollection" "AllowTelemetry" 0 -Write-Host -ForegroundColor White "Modify somes Windows defendenr behaviors :" +Write-Host -ForegroundColor White "`nModify somes Windows defendenr behaviors :" # Windows Defender Delivery Optimization Download modify_shitty_reg_value "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\DeliveryOptimization\Config" "DODownloadMode" "0" # Windows Defender Behavior monitoring and Spynet reporting. @@ -273,7 +281,7 @@ modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spyn modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows Defender\Spynet" "SubmitSamplesConsent" 2 -Write-Host -ForegroundColor White "Disable Wifi-Sense :" +Write-Host -ForegroundColor White "`nDisable Wifi-Sense :" # WifiSense Credential Share modify_shitty_reg_value "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\features" "WiFiSenseCredShared" "0" # WifiSense Open-ness @@ -281,12 +289,12 @@ modify_shitty_reg_value "HKLM:\SOFTWARE\Microsoft\WcmSvc\wifinetworkmanager\feat # Disable Cortana -Write-Host -ForegroundColor White "Disable Cortana (online at least) :" +Write-Host -ForegroundColor White "`nDisable Cortana (online at least) :" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\" "AllowCortana" "0" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Windows Search\" "ConnectedSearchUseWeb" "0" # App right. -Write-Host -ForegroundColor White "Disable rights for applications :" +Write-Host -ForegroundColor White "`nDisable rights for applications :" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessAccountInfo" 2 modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessCalendar" 2 modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessCallHistory" 2 @@ -302,11 +310,11 @@ modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" " modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsSyncWithDevices" 2 # MS Account -Write-Host -ForegroundColor White "Disable MS online account for login :" +Write-Host -ForegroundColor White "`nDisable MS online account for login :" modify_shitty_reg_value "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" "NoConnectedUser" 3 # App suggestion (Cloud Content) -Write-Host -ForegroundColor White "Disable suggestions :" +Write-Host -ForegroundColor White "`nDisable suggestions :" modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\Cloud Content" "DisableWindowsConsumerFeatures" 1 Write-Host "all done!"