Skip to content

Instantly share code, notes, and snippets.

@XenHat
Last active November 5, 2017 22:18
Show Gist options
  • Save XenHat/d10f701c2c031ff593f96c268fc49494 to your computer and use it in GitHub Desktop.
Save XenHat/d10f701c2c031ff593f96c268fc49494 to your computer and use it in GitHub Desktop.
Uninstall Default Windows 8+ Modern Apps
$WMI = get-appxpackage -allusers | Where-Object { $_.name -NotMatch ".NET" <# NEVER DELET DIS #>`
<# System Apps #>`
-And $_.name -NotMatch "1527c705-839a-4832-9118-54d4Bd6a0c89" `
-And $_.name -NotMatch "AccountsControl" `
-And $_.name -NotMatch "BioEnrollment" `
-And $_.name -NotMatch "BrokerPlugin" `
-And $_.name -NotMatch "c5e2524a-ea46-4f67-841f-6a9465d9d515" `
-And $_.name -NotMatch "ChxApp" `
-And $_.name -NotMatch "communication" `
-And $_.name -NotMatch "ContactSupport" `
-And $_.name -NotMatch "ContentDeliveryManager" `
-And $_.name -NotMatch "Cortana" `
-And $_.name -NotMatch "CredDialogHost" `
-And $_.name -NotMatch "DesktopAppInstaller" `
-And $_.name -NotMatch "E2A4F912-2574-4A75-9BB0-0D023378592B" `
-And $_.name -NotMatch "ECApp" `
-And $_.name -NotMatch "EnvironmentsApp" `
-And $_.name -NotMatch "ExperienceHost" `
-And $_.name -NotMatch "F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE" `
-And $_.name -NotMatch "Feedback" `
-And $_.name -NotMatch "HolographicFirstRun" `
-And $_.name -NotMatch "immersivecontrolpanel" `
-And $_.name -NotMatch "InputApp" `
-And $_.name -NotMatch "LockApp" `
-And $_.name -NotMatch "Microsoft.DesktopAppInstaller" `
-And $_.name -NotMatch "MicrosoftEdge" `
-And $_.name -NotMatch "Miracast" `
-And $_.name -NotMatch "MSPaint" `
-And $_.name -NotMatch "Native.Framework" `
-And $_.name -NotMatch "Native.Runtime" `
-And $_.name -NotMatch "ParentalControls" `
-And $_.name -NotMatch "People" `
-And $_.name -NotMatch "PinningConfirmationDialog" `
-And $_.name -NotMatch "PPIProjection" `
-And $_.name -NotMatch "PrintDialog" `
-And $_.name -NotMatch "SecHealthUI" `
-And $_.name -NotMatch "SecondaryTileExperience" `
-And $_.name -NotMatch "SecureAssessmentBrowser" `
-And $_.name -NotMatch "ShellExperienceHost" `
-And $_.name -NotMatch "SoundRecorder" `
-And $_.name -NotMatch "Store" `
-And $_.name -NotMatch "StorePurchaseApp" `
-And $_.name -NotMatch "VCLibs" `
-And $_.name -NotMatch "WindowsCalculator" `
-And $_.name -NotMatch "WindowsCamera" `
-And $_.name -NotMatch "WinJS"`
<# User preferences #>`
-And $_.name -NotMatch "4Dash" `
-And $_.name -NotMatch "8Stream" `
-And $_.name -NotMatch "Anime9" `
-And $_.name -NotMatch "AnimeTubeUniversal" `
-And $_.name -NotMatch "ArduinoIDE" `
-And $_.name -NotMatch "Audiocloud" `
-And $_.name -NotMatch "BingWeather" `
-And $_.name -NotMatch "Weather" `
-And $_.name -NotMatch "communications" `
-And $_.name -NotMatch "CortanaListenUIApp" `
-And $_.name -NotMatch "CrystalDiskMark5" `
-And $_.name -NotMatch "Danbooru" `
-And $_.name -NotMatch "EarTrumpet" `
-And $_.name -NotMatch "ExosSaga" `
-And $_.name -NotMatch "FalloutShelter" `
-And $_.name -NotMatch "Mail" `
-And $_.name -NotMatch "MinecraftUWP" `
-And $_.name -NotMatch "MonocleGiraffe" `
-And $_.name -NotMatch "Nesbox" `
-And $_.name -NotMatch "Netflix" `
-And $_.name -NotMatch "OneNote" `
-And $_.name -NotMatch "Photos" `
-And $_.name -NotMatch "PixelArtStudio" `
-And $_.name -NotMatch "RedViewer" `
-And $_.name -NotMatch "RykenApps.435307C335C44" `
-And $_.name -NotMatch "Singuler" `
-And $_.name -NotMatch "SoundByte" `
-And $_.name -NotMatch "Steamflix" `
-And $_.name -NotMatch "TorrexPro" `
-And $_.name -NotMatch "uBlockOrigin" `
-And $_.name -NotMatch "Ubuntu" `
-And $_.name -NotMatch "Unstream" `
-And $_.name -NotMatch "ValleySoftware.246828F2F9107" `
-And $_.name -NotMatch "Wedge" `
-And $_.name -NotMatch "WinJS" `
-And $_.name -NotMatch "Xbox" `
-And $_.name -NotMatch "XYZAnimePlayerEX" `
} | remove-appxpackage
function Pin-App2 { param(
[string]$appname,
[switch]$unpin
)
try{
if ($unpin.IsPresent){
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Von "Start" lösen|Unpin from Start'} | %{$_.DoIt()}
return "App '$appname' unpinned from Start"
}else{
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'An "Start" anheften|Pin to Start'} | %{$_.DoIt()}
return "App '$appname' pinned to Start"
}
}catch{
Write-Error "Error Pinning/Unpinning $appname! (App-Name correct?)"
}
}
function Pin-App ([string]$appname, [switch]$unpin, [switch]$start, [switch]$taskbar, [string]$path) {
if ($unpin.IsPresent) {
$action = "Unpin"
} else {
$action = "Pin"
}
if (-not $taskbar.IsPresent -and -not $start.IsPresent) {
Write-Error "Specify -taskbar and/or -start!"
}
if ($taskbar.IsPresent) {
try {
$exec = $false
if ($action -eq "Unpin") {
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from taskbar'} | %{$_.DoIt(); $exec = $true}
if ($exec) {
Write "App '$appname' unpinned from Taskbar"
} else {
if (-not $path -eq "") {
Pin-App-by-Path $path -Action $action
} else {
Write "'$appname' not found or 'Unpin from taskbar' not found on item!"
}
}
} else {
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Pin to taskbar'} | %{$_.DoIt(); $exec = $true}
if ($exec) {
Write "App '$appname' pinned to Taskbar"
} else {
if (-not $path -eq "") {
Pin-App-by-Path $path -Action $action
} else {
Write "'$appname' not found or 'Pin to taskbar' not found on item!"
}
}
}
} catch {
Write-Error "Error Pinning/Unpinning $appname to/from taskbar!"
}
}
if ($start.IsPresent) {
try {
$exec = $false
if ($action -eq "Unpin") {
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Unpin from Start'} | %{$_.DoIt(); $exec = $true}
if ($exec) {
Write "App '$appname' unpinned from Start"
} else {
if (-not $path -eq "") {
Pin-App-by-Path $path -Action $action -start
} else {
Write "'$appname' not found or 'Unpin from Start' not found on item!"
}
}
} else {
((New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() | ?{$_.Name -eq $appname}).Verbs() | ?{$_.Name.replace('&','') -match 'Pin to Start'} | %{$_.DoIt(); $exec = $true}
if ($exec) {
Write "App '$appname' pinned to Start"
} else {
if (-not $path -eq "") {
Pin-App-by-Path $path -Action $action -start
} else {
Write "'$appname' not found or 'Pin to Start' not found on item!"
}
}
}
} catch {
Write-Error "Error Pinning/Unpinning $appname to/from Start!"
}
}
}
function Pin-App-by-Path([string]$Path, [string]$Action, [switch]$start) {
if ($Path -eq "") {
Write-Error -Message "You need to specify a Path" -ErrorAction Stop
}
if ($Action -eq "") {
Write-Error -Message "You need to specify an action: Pin or Unpin" -ErrorAction Stop
}
if ((Get-Item -Path $Path -ErrorAction SilentlyContinue) -eq $null){
Write-Error -Message "$Path not found" -ErrorAction Stop
}
$Shell = New-Object -ComObject "Shell.Application"
$ItemParent = Split-Path -Path $Path -Parent
$ItemLeaf = Split-Path -Path $Path -Leaf
$Folder = $Shell.NameSpace($ItemParent)
$ItemObject = $Folder.ParseName($ItemLeaf)
$Verbs = $ItemObject.Verbs()
if ($start.IsPresent) {
switch($Action){
"Pin" {$Verb = $Verbs | Where-Object -Property Name -EQ "&Pin to Start"}
"Unpin" {$Verb = $Verbs | Where-Object -Property Name -EQ "Un&pin from Start"}
default {Write-Error -Message "Invalid action, should be Pin or Unpin" -ErrorAction Stop}
}
} else {
switch($Action){
"Pin" {$Verb = $Verbs | Where-Object -Property Name -EQ "Pin to Tas&kbar"}
"Unpin" {$Verb = $Verbs | Where-Object -Property Name -EQ "Unpin from Tas&kbar"}
default {Write-Error -Message "Invalid action, should be Pin or Unpin" -ErrorAction Stop}
}
}
if($Verb -eq $null){
Write-Error -Message "That action is not currently available on this Path" -ErrorAction Stop
} else {
$Result = $Verb.DoIt()
}
}
<# Unpin a bunch of apps #>
Pin-App "Mail" -unpin -start -taskbar
Pin-App "Store" -unpin -start -taskbar
Pin-App "Paint 3D" -unpin -start -taskbar
Pin-App "Calendar" -unpin -start -taskbar
Pin-App "Microsoft Edge" -unpin -start -taskbar
Pin-App "Photos" -unpin -start -taskbar
Pin-App "Cortana" -unpin -start -taskbar
Pin-App "Weather" -unpin -start -taskbar
Pin-App "Phone Companion" -unpin -start -taskbar
Pin-App "Music" -unpin -start -taskbar
Pin-App "xbox" -unpin -start -taskbar
Pin-App "movies & tv" -unpin -start -taskbar
Pin-App "microsoft solitaire collection" -unpin -start -taskbar
Pin-App "money" -unpin -start -taskbar
Pin-App "get office" -unpin -start -taskbar
Pin-App "onenote" -unpin -start -taskbar
Pin-App "news" -unpin -start -taskbar
<# Re-pin useful ones #>
Pin-App "Mail" -pin -taskbar
Pin-App "Store" -pin -start
Pin-App "Calendar" -pin -start
Pin-App "Weather" -pin -start
Pin-App "Calculator" -pin -start
<# Turn off app suggestions #>
Set-ItemProperty -Path HKCU:\Software\Microsoft\Windows\CurrentVersion\ContentDeliveryManager -Name SystemPaneSuggestionsEnabled -Value 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment