Skip to content

Commit 53cd44c

Browse files
authored
Add files via upload
1 parent f84c993 commit 53cd44c

File tree

2 files changed

+156
-0
lines changed

2 files changed

+156
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
Import-Module -Name Appx -ErrorAction Stop
2+
3+
$applist = @(
4+
"Microsoft.3DBuilder", # 3D Builder
5+
"Microsoft.DesktopAppInstaller", # App Installer
6+
"Microsoft.GetHelp", # Get Help
7+
"Microsoft.Getstarted", # Tips
8+
"Microsoft.Messaging", # Messaging
9+
"Microsoft.Microsoft3DViewer", # 3D Viewer (formerly Mixed Reality Viewer, View 3D)
10+
"Microsoft.MicrosoftOfficeHub", # My Office
11+
"Microsoft.MicrosoftSolitaireCollection", # Solitaire Collection
12+
"Microsoft.MixedReality.Portal", # Mixed Reality Portal
13+
"Microsoft.MSPaint", # Paint 3D
14+
"Microsoft.Office.OneNote", # OneNote (the pathetic remake, not the original)
15+
"Microsoft.OneConnect", # Paid Wi-Fi & Cellular
16+
"Microsoft.Print3D", # Print 3D
17+
"Windows.Print3D", # Print 3D backend
18+
"Microsoft.StorePurchaseApp", # Store Purchase App
19+
"Microsoft.Wallet", # Pay
20+
"Microsoft.WindowsFeedbackHub", # Feedback Hub
21+
"Microsoft.WindowsSoundRecorder", # Voice Recorder
22+
"Microsoft.Xbox.TCUI", # Xbox Live in-game experience
23+
"Microsoft.XboxApp", # Xbox Console Companion (formerly Xbox)
24+
"Microsoft.XboxGameOverlay", # Xbox Game Bar Plug-in
25+
"Microsoft.XboxGamingOverlay", # Xbox Game Bar
26+
"Microsoft.XboxIdentityProvider", # Xbox Identity Provider
27+
"Microsoft.XboxSpeechToTextOverlay", # ???
28+
"Microsoft.YourPhone", # Your Phone
29+
"Microsoft.ZuneMusic", # Groove
30+
"Microsoft.ZuneVideo", # Movies & TV
31+
"Windows.ContactSupport", # Contact Support
32+
"ActiproSoftwareLLC.562882FEEB491", # Code Writer
33+
"46928bounde.EclipseManager", # Eclipse Manager
34+
"PandoraMediaInc.29680B314EFC2", # Pandora
35+
"AdobeSystemIncorporated. AdobePhotoshop", # Adobe Photoshop Express
36+
"D5EA27B7.Duolingo- LearnLanguagesforFree", # Duolingo
37+
"Microsoft.NetworkSpeedTest", # Network Speed Test
38+
"Microsoft.BingNews", # Bing News
39+
"Microsoft.Office.Sway" # Office Sway
40+
)
41+
42+
foreach ($app in $applist) {
43+
Write-Output $("Looking for {0}" -f $app)
44+
$APPXs = Get-AppxPackage $app -AllUsers
45+
if ($null -ne $APPXs )
46+
{
47+
foreach ($APPX in $APPXs) {
48+
Write-Output $("Removing {0}" -f $APPX.ToString())
49+
Remove-AppxPackage -AllUsers -Package $APPX
50+
}
51+
Remove-Variable APPX
52+
} else {
53+
Write-Output $("{0} is not installed." -f $app)
54+
}
55+
Write-Output ""
56+
}

AppX/Inventory AppX Packages.ps1

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
[CmdletBinding()]
2+
param (
3+
)
4+
5+
<#
6+
C# code to expose SHLoadIndirectString(), derived from:
7+
Title: Expand-IndirectString.ps1
8+
Author: Jason Fossen, Enclave Consulting LLC (www.sans.org/sec505)
9+
Date: 20 September 2016
10+
URL: https://github.com/SamuelArnold/StarKill3r/blob/master/Star%20Killer/Star%20Killer/bin/Debug/Scripts/SANS-SEC505-master/scripts/Day1-PowerShell/Expand-IndirectString.ps1
11+
12+
Jason has released his code to public domain.
13+
#>
14+
$CSharpSHLoadIndirectString = @'
15+
using System;
16+
using System.Text;
17+
using System.Runtime.InteropServices;
18+
19+
public class IndirectStrings
20+
{
21+
[DllImport("shlwapi.dll", BestFitMapping = false, CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = false, ThrowOnUnmappableChar = true)]
22+
internal static extern int SHLoadIndirectString(string pszSource, StringBuilder pszOutBuf, uint cchOutBuf, IntPtr ppvReserved);
23+
24+
public static string GetIndirectString(string indirectString)
25+
{
26+
StringBuilder lptStr = new StringBuilder(1024);
27+
int returnValue = SHLoadIndirectString(indirectString, lptStr, (uint)lptStr.Capacity, IntPtr.Zero);
28+
29+
return returnValue == 0 ? lptStr.ToString() : null;
30+
}
31+
}
32+
'@
33+
34+
# Add the IndirectStrings type to PowerShell
35+
Add-Type -TypeDefinition $CSharpSHLoadIndirectString -Language CSharp
36+
37+
<#
38+
Usage examples:
39+
40+
$instr1 = '@%SystemRoot%\system32\shell32.dll,-21801'
41+
$instr2 = '@{This.is.deliberately.invalid}'
42+
$instr3 = '@{c5e2524a-ea46-4f67-841f-6a9465d9d515_10.0.18362.267_neutral_neutral_cw5n1h2txyewy?ms-resource://FileExplorer/Resources/AppxManifest_DisplayName}'
43+
44+
[IndirectStrings]::GetIndirectString( $instr1 )
45+
[IndirectStrings]::GetIndirectString( $instr2 )
46+
[IndirectStrings]::GetIndirectString( $instr3 )
47+
#>
48+
49+
# Get a list of Appx packages
50+
$AppxPackages = Get-AppxPackage -Verbose
51+
$AppxSum = $AppxPackages.Count
52+
53+
# Create an array to store Appx identities
54+
Class AppxIdentity {
55+
[ValidateNotNullOrEmpty()][string]$Name
56+
[string]$DisplayNameResolved
57+
[string]$DisplayNameRaw
58+
}
59+
[AppxIdentity[]]$AppxIdentities = [AppxIdentity[]]::New($AppxSum)
60+
61+
# Access the AppX repository in the Registry
62+
Push-Location "Registry::HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\AppModel\Repository\Packages"
63+
64+
for ($i = 0; $i -lt $AppxSum; $i++) {
65+
# These variables help make the code more compact
66+
# AXN, AXF and AXI respectively mean AppX Name, AppX Fullname and AppX Identity
67+
$AXN = $AppxPackages[$i].Name
68+
$AXF = $AppxPackages[$i].PackageFullName
69+
$AXI = New-Object -TypeName AppxIdentity
70+
71+
# The first property is easy to acquire
72+
$AXI.Name = $AXN
73+
74+
#The display name is stored in the Registry
75+
If (Test-Path $AXF) {
76+
try {
77+
$AXI.DisplayNameRaw = (Get-ItemProperty -Path $AXF -Name DisplayName).DisplayName
78+
if ($AXI.DisplayNameRaw -match '^@') {
79+
$AXI.DisplayNameResolved = [IndirectStrings]::GetIndirectString( $AXI.DisplayNameRaw )
80+
if ($AXI.DisplayNameResolved -eq '') {
81+
Write-Warning "$($AXN): Could not resolve the display name."
82+
}
83+
} else {
84+
$AXI.DisplayNameResolved = $AXI.DisplayNameRaw
85+
if ($AXI.DisplayNameRaw -match '^ms-resource\:') {
86+
Write-Verbose = 'For the want of an @, a kingdom is lost.'
87+
}
88+
}
89+
} catch {
90+
Write-Verbose "$($AXN): There are no display names associated with this package."
91+
}
92+
}
93+
94+
#Hand over the gather info to the array
95+
$AppxIdentities[$i] = $AXI
96+
}
97+
98+
Pop-Location
99+
100+
$AppxIdentities

0 commit comments

Comments
 (0)