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
58
cleanW10.ps1
58
cleanW10.ps1
|
@ -54,7 +54,7 @@ function block_shitty_ip {
|
|||
Write-Host -Nonewline -ForegroundColor Red " Error "
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function remove_shitty_tasks () {
|
||||
|
@ -80,10 +80,10 @@ function remove_shitty_tasks () {
|
|||
}
|
||||
|
||||
# Modify a reg value
|
||||
# Params :
|
||||
# Params :
|
||||
# path : the complete path to reg key
|
||||
# key : key name
|
||||
# value : The value to write
|
||||
# value : The value to write
|
||||
function modify_shitty_reg_value {
|
||||
param([string]$path, [string]$key, [string]$value, [string]$type)
|
||||
Write-Host -ForegroundColor white -NoNewline "Modify $key reg value to $value :"
|
||||
|
@ -91,13 +91,13 @@ function modify_shitty_reg_value {
|
|||
Write-Host -ForegroundColor Gray -NoNewline " creating path "
|
||||
New-Item -Path $path -Force | Out-Null
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
if ($type) {
|
||||
Set-ItemProperty -Path $path -Name $key -Value $value -Type $type -Force
|
||||
if ($type) {
|
||||
Set-ItemProperty -Path $path -Name $key -Value $value -Type $type -Force
|
||||
}
|
||||
else {
|
||||
Set-ItemProperty -Path $path -Name $key -Value $value -Type Dword -Force
|
||||
Set-ItemProperty -Path $path -Name $key -Value $value -Type Dword -Force
|
||||
}
|
||||
}
|
||||
catch [System.Security.SecurityException]{
|
||||
|
@ -140,19 +140,35 @@ function disable_shitty_feature {
|
|||
# $name : Name of modern app
|
||||
function disable_shitty_modern_app {
|
||||
param([string]$name)
|
||||
Write-Host -ForegroundColor white -NoNewline "Remove $name modern app"
|
||||
try {
|
||||
$pkgname = Get-AppxPackage -allusers -name *$name*
|
||||
if (Get-AppxPackage $pkgname.Name) {
|
||||
Remove-AppxPackage $pkgname
|
||||
}
|
||||
Get-AppxProvisionedPackage -Online | where-Object {$_.PackageName -like "*$name*"} | Remove-AppxProvisionedPackage -Online | Out-Null
|
||||
}
|
||||
catch {
|
||||
Write-Host -ForegroundColor Red " Error "
|
||||
return
|
||||
}
|
||||
Write-Host -ForegroundColor Green " Done "
|
||||
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"
|
||||
}
|
||||
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
|
||||
}
|
||||
Write-Host -ForegroundColor Green " Done"
|
||||
}
|
||||
else { Write-Host -ForegroundColor Yellow " Not provisionned"}
|
||||
}
|
||||
|
||||
function disable_shitty_service ([string]$name){
|
||||
|
@ -234,7 +250,7 @@ modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "
|
|||
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessCalendar" 2
|
||||
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessCallHistory" 2
|
||||
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessCamera" 2
|
||||
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessContacts" 2
|
||||
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessContacts" 2
|
||||
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessEmail" 2
|
||||
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessLocation" 2
|
||||
modify_shitty_reg_value "HKLM:\SOFTWARE\Policies\Microsoft\Windows\AppPrivacy" "LetAppsAccessMessaging" 2
|
||||
|
|
Reference in a new issue