From 43cfa8fa9d65a10caab9e14430d90985d16cdb6d Mon Sep 17 00:00:00 2001 From: Yorick Date: Thu, 8 Sep 2016 17:21:50 +0200 Subject: [PATCH] Reworked disableModernShitty funciton to remove modern apps from AppxProvisionnedPackage --- cleanW10.ps1 | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cleanW10.ps1 b/cleanW10.ps1 index dd757d7..57c8ba6 100755 --- a/cleanW10.ps1 +++ b/cleanW10.ps1 @@ -110,7 +110,7 @@ function disableShitty { try { Dism /online /Disable-Feature /FeatureName:$name /NoRestart| Out-Null } - catch { + catch { Write-Host -ForegroundColor Red " Error" Return } @@ -128,7 +128,11 @@ function disableModernShitty { param([string]$name) Write-Host -ForegroundColor white -NoNewline "Remove $name modern app" try { - Get-AppxPackage -AllUsers -name *$name* | Remove-AppxPackage + $pkgname = Get-AppxPackage -allusers -name *$name* + if (Get-AppxPackage $pkgname) { + Remove-AppxPackage $pkgname + } + Get-AppxProvisionedPackage -Online | where-Object {$_.PackageName -like "*$name*"} | Remove-AppxProvisionedPackage -Online | Out-Null } catch { Write-Host -ForegroundColor Red " Error " @@ -156,12 +160,12 @@ function disableShittyService ([string]$name){ Write-Output "" Write-Output "I's time to kick ass and chew bubble gum" Write-Output "________________________________________" -write-Output "" +write-Output "" $shittyFeatures | foreach { disableShitty $_ } $shittyServices | Foreach { disableShittyService $_ } $shittyModernApp | Foreach { disableModernShitty $_ } -$shittyHosts | Foreach { blockShittyHost $HOST_FILE $HOST_IP $_ } +$shittyHosts | Foreach { blockShittyHost $HOST_FILE $HOST_IP $_ } remove_shittyTasks $shittyTasks $shittyIP | Foreach { @@ -188,6 +192,6 @@ modifyShittyRegValue "HKLM:\SOFTWARE\Microsoft\Windows Defender\Spynet" "SpyNetR # Windows Defender Sample Submission modifyShittyRegValue "HKLM:\SOFTWARE\Microsoft\Windows Defender\Spynet" "SubmitSamplesConsent" "0" -#Désinstallation des applications "métro" inutiles +#Désinstallation des applications "métro" inutiles #Get-AppxPackage -AllUsers | Remove-AppxPackage #Get-AppXProvisionedPackage -online | remove-appxprovisionedpackage -online