Skip to content

Commit 8f2e30f

Browse files
committed
January 2025 update
See the change log for details.
1 parent db92ab3 commit 8f2e30f

33 files changed

+869
-197
lines changed

Apps/Get AppX package names.ps1

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,24 @@
22

33
<#
44
.SYNOPSIS
5-
Returns the package identities and display names of all installed packaged apps (AppX)
5+
Returns the friendly app names of all packaged apps (AppX or MSIX) installed for the current user.
66
.DESCRIPTION
7-
Get-AppxPackage returns a list of all installed packaged apps, along with their "Name",
8-
"PackageFullName", and "PackageFamilyName" properties. None of these are human-consumable. For
9-
example, what is "58027.265370AB8DB33_fjemmk5ta3a5g"? This script reveals the display name of all
10-
installed packaged apps.
7+
Starting with Windows 8, Microsoft created an app architecture that was optimized for distribution
8+
via Microsoft Store. After many name changes (Metro-style app, modern app, Store app, UWP app,
9+
WinRT app, etc.), Microsoft has finally settled for "Packaged app" because these apps have package
10+
identities. These apps must be distributed in AppX or MSIX packages.
11+
12+
The `Get-AppxPackage` cmdlet returns a list of all packaged apps on the system along with their
13+
package IDs, e.g., `58027.265370AB8DB33_fjemmk5ta3a5g`. However, the cmdlet doesn't show their app
14+
names. This script mitigates that issue. It lists all packaged apps installed for the current user
15+
account, along with their app names.
1116
.NOTES
12-
DEPRECATED
17+
DEPRECATED. Please use WinGet instead.
1318
14-
This script depends on Get-AppxPackage and its Appx module. As such, it won't work in PowerShell
15-
6 and later.
19+
You can pipe the output of this script to `Format-Table` or `Format-List` cmdlets.
1620
17-
Instead of this script, consider using WinGet.exe.
21+
The script accepts a `-Verbose` switch to display the names packages for which the name resolution
22+
failed.
1823
.LINK
1924
None
2025
.EXAMPLE

Apps/Get installed apps.ps1

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
1-
<#
1+
#Requires -Version 5.1
2+
3+
<#
24
.SYNOPSIS
35
Queries Windows Registry for a list of installed apps
4-
.DESCRIPTION
5-
Queries Windows Registry for a list of apps that have registered uninstallers. Displays their
6-
CPU architecture mode (Arch), friendly name, and their registered uninstaller.
7-
.EXAMPLE
6+
.DESCRIPTION
7+
This script queries Windows Registry for a list of apps that have registered uninstallers, and
8+
displays their target CPU architecture (Arch), friendly name, and their registered uninstaller.
9+
In Windows PowerShell 5.1, you could accomplish the same via the `Get-Package` cmdlet because
10+
Windows comes bundled with a "Programs" package provider. This provider is not available in
11+
PowerShell 7.0 and later.
12+
.EXAMPLE
813
PS C:\> & '.\Get installed apps.ps1' | Format-Table
914
1015
Arch Scope Name Display name Uninstall string
@@ -58,16 +63,13 @@
5863
IA-32 HKLM {1a7abdc5-639b-4af0-87c6-dbc511750c6e} Microsoft Windows Desktop Runtime - 6.0.31 (x64) "C:\ProgramData\Package Cache\{1a7abdc5-639b-4af0...
5964
IA-32 HKLM {9FF5D2D9-C74D-47A0-807B-AA2EC7A12F9D} Microsoft Windows Desktop Runtime - 8.0.5 (x86) MsiExec.exe /X{9FF5D2D9-C74D-47A0-807B-AA2EC7A12F9D}
6065
61-
.INPUTS
66+
.INPUTS
6267
None
63-
.OUTPUTS
68+
.OUTPUTS
6469
PSCustomObject[]
65-
.NOTES
66-
The Get-Package cmdlet in Windows PowerShell 5.1 can query Windows Registry for installed apps via
67-
a PackageProvider called "Programs". This package provider was never ported to PowerShell 7.
68-
#>
69-
70-
#Requires -Version 5.1
70+
.NOTES
71+
None
72+
#>
7173

7274
using namespace System.Management.Automation
7375

Apps/Is x64.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
#Requires -Version 5.1
2+
13
<#
24
.SYNOPSIS
35
Determines whether an EXE file is marked as x64.
46
.DESCRIPTION
5-
Determines whether an EXE file is marked as x64.
7+
Windows EXE files have a platform marker. This scripts determines whether that platform marker is
8+
x64 and returns a Boolean in answer to that question. Beware that EXE files NOT marked as x64 can
9+
still extract and run x64-only payloads.
610
.EXAMPLE
711
PS C:\> & "Is x64.ps1" -LiteralPath C:\Windows\Notepad.exe
812
True
@@ -14,8 +18,6 @@
1418
None
1519
#>
1620

17-
#Requires -Version 5.1
18-
1921
using namespace System.Management.Automation
2022

2123
[CmdletBinding()]

Apps/Reinstall AppX Packages.ps1

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,19 @@
44
.SYNOPSIS
55
Re-registers all packaged apps by Microsoft Corporation for the current user.
66
.DESCRIPTION
7-
Looks for all mainline packaged apps whose publishers are "cw5n1h2txyewy" (Microsoft apps) or
8-
"8wekyb3d8bbwe" (Windows components). Re-registers them for the current user.
7+
This script queries all mainline packaged apps whose publishers are "cw5n1h2txyewy" (Microsoft
8+
apps) or "8wekyb3d8bbwe" (Windows components). Re-registers them for the current user.
99
.NOTES
10-
DEPRECATED
10+
DEPRECATED. I strongly recommend not to use it.
1111
1212
This script depends on Get-AppxPackage and its Appx module. As such, it won't work in PowerShell
13-
6 and later.
13+
6 and later, and returns an error (System.PlatformNotSupportedException).
1414
.LINK
1515
None
1616
#>
1717

18+
Import-Module -Name Appx -ErrorAction "Stop"
19+
1820
$MicrosoftPublisherIDs = @(
1921
"cw5n1h2txyewy", # CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
2022
"8wekyb3d8bbwe" # CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US

Apps/Remove AppX packages.ps1

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,23 @@
22

33
<#
44
.SYNOPSIS
5-
Uninstalls certain packaged apps for the current user.
5+
Uninstalls packaged apps bundled with Windows from the current user account.
66
.DESCRIPTION
7-
When Windows 10 was first published in 2015, it was bloated with marginally useful AppX packages.
7+
When Windows 10 was first published in 2015, it was bloated with marginally useful packaged apps.
88
To their credit, they had no performance impact. Yet, their very existence was a violation of the
9-
principle of lean systems.
9+
principle of lean systems. This script uninstalls them all for the current user.
10+
.NOTES
11+
DEPRECATED. Please use WinGet instead.
1012
11-
This script uninstalls them all for the current user. The script requires no administrative
12-
privileges.
13-
.NOTES
14-
DEPRECATED
13+
The script requires no administrative privileges.
1514
16-
This script requires Remove-AppxPackage and its Appx module. As such, it won't work in PowerShell
17-
6 and later.
18-
19-
Instead of this script, consider using WinGet.exe.
15+
This script depends on Get-AppxPackage and its Appx module. As such, it won't work in PowerShell
16+
6 and later, and returns an error (System.PlatformNotSupportedException).
2017
.LINK
2118
None
2219
#>
2320

24-
Import-Module -Name Appx -ErrorAction Stop
21+
Import-Module -Name Appx -ErrorAction "Stop"
2522

2623
$applist = @(
2724
"Microsoft.549981C3F5F10", # Cortana (2nd-Gen)

Apps/Repair system AppX packages.ps1

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
#Requires -RunAsAdministrator
21
#Requires -Version 5.1
2+
#Requires -RunAsAdministrator
33

44
<#
55
.SYNOPSIS
6-
Re-registers all packaged apps marked as System Components for the current user.
6+
Re-registers all AppX packages in the "SystemApp" folder.
77
.DESCRIPTION
8-
Looks for all mainline packaged apps installed in "SystemApp". Re-registers them for the current
9-
user.
8+
This script looks for packages installed in "SystemApp" and re-registers them for the current
9+
user account.
1010
.NOTES
11-
DEPRECATED
11+
DEPRECATED. I strongly recommend not to use it.
1212
13-
This script depends on Get-AppxPackage and its Appx module. As such, it won't work in PowerShell
14-
6 and later.
13+
This script requires administrative privileges.
1514
16-
This script is no longer necessary, thanks to Windows 10 quality having reached acceptable levels
17-
after nine years.
15+
This script depends on Get-AppxPackage and its Appx module. As such, it won't work in PowerShell
16+
6 and later, and returns an error (System.PlatformNotSupportedException).
1817
.LINK
1918
None
2019
#>
2120

21+
Import-Module -Name Appx -ErrorAction "Stop"
22+
2223
Get-AppxPackage -AllUsers | Where-Object InstallLocation -Like "*SystemApp*" | ForEach-Object {
23-
$a=$_
24-
Format-List -InputObject $a -Property Name,InstallLocation
25-
Add-AppxPackage -Path "$($a.InstallLocation)\AppxManifest.xml" -Register -DisableDevelopmentMode
24+
$a=$_
25+
Format-List -InputObject $a -Property Name,InstallLocation
26+
Add-AppxPackage -Path "$($a.InstallLocation)\AppxManifest.xml" -Register -DisableDevelopmentMode
2627
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,60 @@
1+
#Requires -Version 5.1
12
#Requires -RunAsAdministrator
23

4+
<#
5+
.SYNOPSIS
6+
Shows the details of active BITS jobs.
7+
.DESCRIPTION
8+
This script runs `Get-BitsTransfer -AllUsers` and displays jobs whose states are "Transferring" in
9+
details.
10+
.EXAMPLE
11+
PS C:\> & '.\Get active BITS jobs, detailed.ps1'
12+
13+
class BitsJob
14+
{
15+
DisplayName = MozillaUpdate 308046B0AF4A39CB
16+
BytesTotal = 9777572
17+
BytesTransferred = 9777571
18+
FileList =
19+
[
20+
class BitsFile
21+
{
22+
RemoteName = https://download-installer.cdn.mozilla.net/pub/firefox/releases/131.0.2/upda…
23+
LocalName = C:\ProgramData\Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\updates\308046B0A…
24+
IsTransferComplete = False
25+
BytesTotal = 9777572
26+
BytesTransferred = 9777571
27+
}
28+
]
29+
30+
}
31+
32+
class BitsJob
33+
{
34+
DisplayName = Edge Component Updater
35+
BytesTotal = 1673976
36+
BytesTransferred = 1673975
37+
FileList =
38+
[
39+
class BitsFile
40+
{
41+
RemoteName = http://msedge.b.tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/…
42+
LocalName = C:\Users\M\AppData\Local\Packages\microsoft.bingweather_8wekyb3d8bbwe\AC\Temp…
43+
IsTransferComplete = False
44+
BytesTotal = 1673976
45+
BytesTransferred = 1673975
46+
}
47+
]
48+
49+
}
50+
.INPUTS
51+
None
52+
.OUTPUTS
53+
String
54+
.NOTES
55+
None
56+
#>
57+
58+
Import-Module -Name BitsTransfer -ErrorAction "Stop"
59+
360
Get-BitsTransfer -AllUsers | Where-Object {$_.JobState -eq 'Transferring'} | Format-Custom -Property DisplayName,BytesTotal,BytesTransferred,FileList

BITS/Get active BITS jobs, table.ps1

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
1+
#Requires -Version 5.1
12
#Requires -RunAsAdministrator
23

4+
<#
5+
.SYNOPSIS
6+
Shows a table of active BITS jobs.
7+
.DESCRIPTION
8+
This script runs `Get-BitsTransfer -AllUsers` and displays jobs whose states are "Transferring" in
9+
a table.
10+
.EXAMPLE
11+
PS C:\> & '.\Get active BITS jobs, table.ps1'
12+
13+
DisplayName BytesTotal BytesTransferred FileList
14+
----------- ---------- ---------------- --------
15+
MozillaUpdate 308046B0AF4A39CB 9777572 9777571 {https://download-installer.cdn.mozill…
16+
Edge Component Updater 1673976 1673975 {http://msedge.b.tlu.dl.delivery.mp.mi…
17+
.INPUTS
18+
None
19+
.OUTPUTS
20+
String
21+
.NOTES
22+
None
23+
#>
24+
25+
Import-Module -Name BitsTransfer -ErrorAction "Stop"
26+
327
Get-BitsTransfer -AllUsers | Where-Object {$_.JobState -eq 'Transferring'} | Format-Table -Autosize -Property DisplayName,BytesTotal,BytesTransferred,FileList

BITS/Get all BITS jobs, custom.ps1

Lines changed: 65 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,76 @@
11
#Requires -RunAsAdministrator
2+
#Requires -Version 5.1
23

3-
# TO DO: Rewrite using list view
4+
<#
5+
.SYNOPSIS
6+
Short description
7+
.DESCRIPTION
8+
Long description
9+
.EXAMPLE
10+
PS C:\> & '.\Get all BITS jobs, custom.ps1'
11+
12+
──────────────────────────────────────────────────────────────────────────────────────────────────
13+
b8daf1ed-9b93-4feb-bc18-ef16199dec62
14+
MozillaUpdate 308046B0AF4A39CB
15+
Download | Transferred | Foreground
16+
9,777,572 / 9,777,572
17+
Files:
18+
Remote Name: https://download-installer.cdn.mozilla.net/pub/firefox/releases/131.0.2/update/wi
19+
Local Name: C:\ProgramData\Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\updates\308046B0AF4A3
20+
Progress: 9,777,572 / 9,777,572 (Complete)
21+
──────────────────────────────────────────────────────────────────────────────────────────────────
22+
65d9da80-7b13-4da8-93eb-c7408c9ad597
23+
Edge Component Updater
24+
Download | Transferred | Normal
25+
1,673,976 / 1,673,976
26+
Files:
27+
Remote Name: http://msedge.b.tlu.dl.delivery.mp.microsoft.com/filestreamingservice/files/0c12d
28+
Local Name: C:\Users\X\AppData\Local\Packages\microsoft.bingweather_8wekyb3d8bbwe\AC\Temp\edg
29+
Progress: 1,673,976 / 1,673,976 (Complete)
30+
──────────────────────────────────────────────────────────────────────────────────────────────────
31+
05adff0b-36af-4f13-92f1-d798b00e7323
32+
MozillaUpdate 308046B0AF4A39CB
33+
Download | Transferred | Foreground
34+
20,461,606 / 20,461,606
35+
Files:
36+
Remote Name: https://download-installer.cdn.mozilla.net/pub/firefox/releases/132.0/update/win6
37+
Local Name: C:\ProgramData\Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\updates\308046B0AF4A3
38+
Progress: 20,461,606 / 20,461,606 (Complete)
39+
──────────────────────────────────────────────────────────────────────────────────────────────────
40+
af7a4d77-ef30-4f28-900a-279a47028a9f
41+
MozillaUpdate 308046B0AF4A39CB
42+
Download | Transferred | Foreground
43+
17,754,615 / 17,754,615
44+
Files:
45+
Remote Name: https://download-installer.cdn.mozilla.net/pub/firefox/releases/133.0/update/win6
46+
Local Name: C:\ProgramData\Mozilla-1de4eec8-1241-4177-a864-e594e8d1fb38\updates\308046B0AF4A3
47+
Progress: 17,754,615 / 17,754,615 (Complete)
48+
──────────────────────────────────────────────────────────────────────────────────────────────────
49+
.INPUTS
50+
None
51+
.OUTPUTS
52+
String
53+
.NOTES
54+
None
55+
#>
456

557
function Main {
658
$OutputTemplate1 = "{0}`n{1}`n{2} | {3} | {4}`n{5:N0} / {6:N0}`nFiles:"
759
$OutputTemplate2 = " Remote Name: {0}`n Local Name: {1}`n Progress: {2:N0} / {3:N0} ({4})"
8-
$SplitterLine = [String]::new([char]0x2500, 110)
60+
#OutputTemplate1: JobId, DisplayName, TransferType, JobState, Priority, BytesTransferred, BytesTotal
61+
#OutputTemplate2: RemoteName, LocalName, BytesTransferred, BytesTotal, "Complete"/"Pending"
62+
63+
try {
64+
$BufferWidth = [Console]::BufferWidth
65+
if ($BufferWidth -lt 10) { $BufferWidth = 110 }
66+
}
67+
catch {
68+
$BufferWidth = 110
69+
}
70+
$SplitterLine = [String]::new([char]0x2500, $BufferWidth)
971

1072
# The following only works in PowerShell 7.x:
11-
# $SplitterLine = [String]::new("`u{2500}", 110)
73+
# $SplitterLine = [String]::new("`u{2500}", $BufferWidth)
1274

1375
$a = Get-BitsTransfer -AllUsers -ErrorAction Stop
1476
if ($null -eq $a) {

0 commit comments

Comments
 (0)