Rewrite disable_shitty_modern_app for better output
This commit is contained in:
parent
3c3c5ed0c6
commit
d2a268ad6c
1 changed files with 37 additions and 21 deletions
30
cleanW10.ps1
30
cleanW10.ps1
|
@ -140,20 +140,36 @@ function disable_shitty_feature {
|
||||||
# $name : Name of modern app
|
# $name : Name of modern app
|
||||||
function disable_shitty_modern_app {
|
function disable_shitty_modern_app {
|
||||||
param([string]$name)
|
param([string]$name)
|
||||||
Write-Host -ForegroundColor white -NoNewline "Remove $name modern app"
|
Write-Host -ForegroundColor white -NoNewLine "Remove $name modern app"
|
||||||
|
$package = Get-AppxPackage -AllUsers -name *$name*
|
||||||
|
if ( $package ) {
|
||||||
|
Write-Host -ForegroundColor white -NoNewLine " installed :"
|
||||||
try {
|
try {
|
||||||
$pkgname = Get-AppxPackage -allusers -name *$name*
|
$package | Remove-AppxPackage
|
||||||
if (Get-AppxPackage $pkgname.Name) {
|
|
||||||
Remove-AppxPackage $pkgname
|
|
||||||
}
|
|
||||||
Get-AppxProvisionedPackage -Online | where-Object {$_.PackageName -like "*$name*"} | Remove-AppxProvisionedPackage -Online | Out-Null
|
|
||||||
}
|
}
|
||||||
catch {
|
catch {
|
||||||
Write-Host -ForegroundColor Red " Error "
|
Write-Host -ForegroundColor Red " Uninstall error"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
Write-Host -ForegroundColor Green -NoNewLine " uninstalled"
|
||||||
|
}
|
||||||
|
else { Write-Host -ForegroundColor Yellow -NoNewLine " Not installed"}
|
||||||
|
|
||||||
|
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
|
return
|
||||||
}
|
}
|
||||||
Write-Host -ForegroundColor Green " Done"
|
Write-Host -ForegroundColor Green " Done"
|
||||||
}
|
}
|
||||||
|
else { Write-Host -ForegroundColor Yellow " Not provisionned"}
|
||||||
|
}
|
||||||
|
|
||||||
function disable_shitty_service ([string]$name){
|
function disable_shitty_service ([string]$name){
|
||||||
Write-Host -ForegroundColor White -NoNewline "Disable service $name :"
|
Write-Host -ForegroundColor White -NoNewline "Disable service $name :"
|
||||||
|
|
Reference in a new issue