Reworked modern app uninstall
This commit is contained in:
parent
e85b87fb15
commit
4650f48ee3
1 changed files with 32 additions and 31 deletions
63
cleanW10.ps1
63
cleanW10.ps1
|
@ -136,40 +136,35 @@ function disable_shitty_feature {
|
|||
}
|
||||
}
|
||||
|
||||
# disable "Modern App"
|
||||
# remove unwanted "Modern App"
|
||||
# Params
|
||||
# $name : Name of modern app
|
||||
function disable_shitty_modern_app {
|
||||
param([string]$name)
|
||||
Write-Host -ForegroundColor white -NoNewLine "Remove $name modern app"
|
||||
$package = Get-AppxPackage -AllUsers -name *$name*
|
||||
if ( $package ) {
|
||||
Write-Host -ForegroundColor white -NoNewLine " installed :"
|
||||
try {
|
||||
$package | Remove-AppxPackage
|
||||
}
|
||||
catch {
|
||||
Write-Host -ForegroundColor Red " Uninstall error"
|
||||
return
|
||||
}
|
||||
Write-Host -ForegroundColor Green -NoNewLine " uninstalled"
|
||||
# $pkg : Package (Object)
|
||||
function remove_shitty_modern_app {
|
||||
param($pkg)
|
||||
Write-Host -ForegroundColor white -NoNewLine "Remove $($pkg.Name) modern app"
|
||||
try {
|
||||
$pkg | Remove-AppxPackage
|
||||
}
|
||||
else { Write-Host -ForegroundColor Yellow -NoNewLine " Not installed"}
|
||||
catch {
|
||||
Write-Host -ForegroundColor Red " error"
|
||||
write-Host $Error[0]
|
||||
retur
|
||||
}
|
||||
Write-Host -ForegroundColor Green " done"
|
||||
}
|
||||
|
||||
Write-Host -ForegroundColor white -NoNewLine " |"
|
||||
$provisioned = Get-AppxProvisionedPackage -Online | where-Object {$_.PackageName -like "*$name*"}
|
||||
if ( $provisioned ) {
|
||||
Write-Host -ForegroundColor White -NoNewLine " Provisonned"
|
||||
try {
|
||||
$provisioned | Remove-AppxProvisionedPackage -Online | Out-Null
|
||||
}
|
||||
catch {
|
||||
Write-Host -ForegroundColor red " Error"
|
||||
return
|
||||
}
|
||||
Write-Host -ForegroundColor Green " Done"
|
||||
function remove_provisioned_shitty_modern_app {
|
||||
param($pkg)
|
||||
Write-Host -ForegroundColor white -NoNewline "remove provisioned $($pkg.DisplayName) : "
|
||||
try {
|
||||
$pkg | Remove-AppxProvisionedPackage -Online | Out-Null
|
||||
}
|
||||
else { Write-Host -ForegroundColor Yellow " Not provisionned"}
|
||||
catch {
|
||||
Write-Host -ForegroundColor red " error"
|
||||
Write-Host $Error[0]
|
||||
return
|
||||
}
|
||||
Write-Host -ForegroundColor Green " done"
|
||||
}
|
||||
|
||||
function disable_shitty_service ([string]$name){
|
||||
|
@ -197,7 +192,13 @@ foreach ($line in Get-Content "lib\hosts.txt"){ block_shitty_host $HOST_FILE $HO
|
|||
foreach ($line in Get-Content "lib\ip.txt"){ block_shitty_ip $line }
|
||||
foreach ($line in Get-Content "lib\features.txt"){ disable_shitty_feature $line }
|
||||
foreach ($line in Get-Content "lib\services.txt") { disable_shitty_featureService $line }
|
||||
foreach ($line in Get-Content "lib\apps.txt") { disable_shitty_modern_app $line }
|
||||
Get-AppxPackage -AllUsers | Where-Object { $_.name -in $(Get-Content "lib\apps.txt")} | foreach {
|
||||
remove_shitty_modern_app $_
|
||||
}
|
||||
Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName -in $(Get-Content "lib\apps.txt")} | foreach {
|
||||
remove_provisioned_shitty_modern_app $_
|
||||
}
|
||||
|
||||
foreach ($line in Get-Content "lib\tasks.txt") {remove_shitty_tasks $line }
|
||||
|
||||
|
||||
|
|
Reference in a new issue