Actualiser powershell/Remove-BuiltInApps.ps1
This commit is contained in:
@@ -53,7 +53,7 @@ foreach ($App in $AppsToRemove) {
|
|||||||
$ProvPkg = Get-AppxProvisionedPackage -Online | Where-Object DisplayName -eq $App.Package
|
$ProvPkg = Get-AppxProvisionedPackage -Online | Where-Object DisplayName -eq $App.Package
|
||||||
if ($ProvPkg) {
|
if ($ProvPkg) {
|
||||||
$ProvPkg | Remove-AppxProvisionedPackage -Online -ErrorAction Stop
|
$ProvPkg | Remove-AppxProvisionedPackage -Online -ErrorAction Stop
|
||||||
Write-Host ("✔ Provisioned package removed: {0}" -f $App.Name) -ForegroundColor Green
|
Write-Host ("Provisioned package removed: {0}" -f $App.Name) -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
Write-Host ("No provisioned package found for {0}" -f $App.Name) -ForegroundColor Yellow
|
Write-Host ("No provisioned package found for {0}" -f $App.Name) -ForegroundColor Yellow
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ foreach ($UserProfile in $UserProfiles) {
|
|||||||
$Pkg = Get-AppxPackage -User $Username -Name $App.Package
|
$Pkg = Get-AppxPackage -User $Username -Name $App.Package
|
||||||
if ($Pkg) {
|
if ($Pkg) {
|
||||||
$Pkg | Remove-AppxPackage -User $Username -ErrorAction Stop
|
$Pkg | Remove-AppxPackage -User $Username -ErrorAction Stop
|
||||||
Write-Host ("✔ Removed {0} from {1}" -f $App.Name, $Username) -ForegroundColor Green
|
Write-Host ("Removed {0} from {1}" -f $App.Name, $Username) -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
Write-Host ("{0} not installed for {1}" -f $App.Name, $Username) -ForegroundColor Yellow
|
Write-Host ("{0} not installed for {1}" -f $App.Name, $Username) -ForegroundColor Yellow
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ foreach ($App in $AppsToRemove) {
|
|||||||
$UserPkg = Get-AppxPackage -Name $App.Package
|
$UserPkg = Get-AppxPackage -Name $App.Package
|
||||||
if ($UserPkg) {
|
if ($UserPkg) {
|
||||||
$UserPkg | Remove-AppxPackage -ErrorAction Stop
|
$UserPkg | Remove-AppxPackage -ErrorAction Stop
|
||||||
Write-Host ("✔ Removed {0} from current user" -f $App.Name) -ForegroundColor Green
|
Write-Host ("Removed {0} from current user" -f $App.Name) -ForegroundColor Green
|
||||||
} else {
|
} else {
|
||||||
Write-Host ("{0} is not installed for current user" -f $App.Name) -ForegroundColor Yellow
|
Write-Host ("{0} is not installed for current user" -f $App.Name) -ForegroundColor Yellow
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user