Skip to content

Commit

Permalink
func: remove-storeapps
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTaylorLee committed Dec 12, 2024
1 parent 7aff6fc commit 58cad70
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 27 deletions.
3 changes: 2 additions & 1 deletion modules/AdminToolbox.EndpointManagement/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,4 +247,5 @@
* **4.11.0.17** CI Maintenance Release
* **4.11.0.18** CI Maintenance Release
* **4.11.0.19** CI Maintenance Release
* **4.11.0.20** CI Maintenance Release
* **4.11.0.20** CI Maintenance Release
* **4.12.0.0** Reworked Remove-Storeapps to be more flexible.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function Get-EndpointManagement {
Write-Host "Join-Domain ..Joins Endpoint to a Domain" -ForegroundColor cyan
Write-Host "Mount-ProfileRegistry ..Mounts local users registry hive" -ForegroundColor cyan
Write-Host "Remove-Shortcuts ..Removes Desktop Shortcuts" -ForegroundColor cyan
Write-Host "Remove-StoreApps ..Removes crap store apps" -ForegroundColor cyan
Write-Host "Remove-StoreApps ..Remove an array of MS store apps" -ForegroundColor cyan
Write-Host "Remove-Tiles ..Removes start menu tiles" -ForegroundColor cyan
Write-Host "Repair-DomainJoin ..Repairs lost Domain Membership" -ForegroundColor cyan
Write-Host "Reset-EndpointPassword ..Reset the endpoints domain password to repair trust" -ForegroundColor cyan
Expand Down
81 changes: 56 additions & 25 deletions modules/AdminToolbox.EndpointManagement/Public/Remove-StoreApps.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
<#
.DESCRIPTION
Removes sponsored Windows store apps and some microsoft apps
Removes specified Windows store apps.
-Microsot Apps Removed
.PARAMETER disablesponsoredapps
Disables sponsored Windows Store apps from returning.
.PARAMETER storeapps
An array of Windows Store apps to remove. Use wildcards (*) to match partial names.
.EXAMPLE
$StoreApps = @(
#Unnecessary Windows 10 AppX Apps
"Microsoft.BingNews"
"Microsoft.BingWeather"
"Microsoft.MicrosoftSolitaireCollection"
Expand All @@ -12,8 +21,26 @@
"Microsoft.WindowsCamera"
"*Skype*"
.EXAMPLE
Remove-StoreApps
#Sponsored Windows 10 AppX Apps
"*EclipseManager*"
"*ActiproSoftwareLLC*"
"*AdobeSystemsIncorporated.AdobePhotoshopExpress*"
"*Duolingo-LearnLanguagesforFree*"
"*PandoraMediaInc*"
"*CandyCrush*"
"*Wunderlist*"
"*Flipboard*"
"*Twitter*"
"*Facebook*"
"*Spotify*"
"*Minecraft*"
"*Royal Revolt*"
)
Remove-StoreApps -storeapps $storeapps -disablesponsoredapps -verbose
Removes all apps in the array.
.Link
https://github.com/TheTaylorLee/AdminToolbox
Expand All @@ -22,14 +49,15 @@
function Remove-StoreApps {

[CmdletBinding(SupportsShouldProcess)]

Param (
[Parameter(Mandatory = $false)][switch]$disablesponsoredapps,
[Parameter(Mandatory = $true)][string[]]$storeapps
)

#Check for Admin Privleges
Get-Elevation

$CrapApps = @(
$StoreApps = @(

#Unnecessary Windows 10 AppX Apps
"Microsoft.BingNews"
Expand Down Expand Up @@ -58,27 +86,30 @@ function Remove-StoreApps {

)

foreach ($Crap in $CrapApps) {
Get-AppxPackage -Name $Crap | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -Like $Crap | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
Write-Output "Removing $Crap if exists."
foreach ($app in $StoreApps) {
Get-AppxPackage -Name $app | Remove-AppxPackage -ErrorAction SilentlyContinue
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -Like $app | Remove-AppxProvisionedPackage -Online -ErrorAction SilentlyContinue
Write-Output "Removing $app if exists."
}

Write-Host "Adding Registry key to prevent crap apps from returning" -ForegroundColor Green
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
$registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
If (!(Test-Path $registryPath)) {
New-Item $registryPath
}
Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1
if ($disablesponsoredapps) {

Write-Host "Adding Registry keys to prevent Sponsored Store apps from returning" -ForegroundColor Green
$registryPath = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent"
$registryOEM = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\ContentDeliveryManager"
If (!(Test-Path $registryPath)) {
New-Item $registryPath
}
Set-ItemProperty $registryPath DisableWindowsConsumerFeatures -Value 1

If (!(Test-Path $registryOEM)) {
New-Item $registryOEM
If (!(Test-Path $registryOEM)) {
New-Item $registryOEM
}
Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
}
Set-ItemProperty $registryOEM ContentDeliveryAllowed -Value 0
Set-ItemProperty $registryOEM OemPreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM PreInstalledAppsEverEnabled -Value 0
Set-ItemProperty $registryOEM SilentInstalledAppsEnabled -Value 0
Set-ItemProperty $registryOEM SystemPaneSuggestionsEnabled -Value 0
}

0 comments on commit 58cad70

Please sign in to comment.