Skip to content

Commit 3bd791e

Browse files
committed
February 2024 update
Please see the change log for details.
1 parent 550f655 commit 3bd791e

12 files changed

+350
-82
lines changed

AppX/Get AppX package names.ps1

Lines changed: 63 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,57 @@
11
#Requires -Version 5.1
22

3+
<#
4+
.SYNOPSIS
5+
Returns the package identities and display names of all installed packaged apps (AppX)
6+
.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.
11+
.NOTES
12+
DEPRECATED
13+
14+
This script depends on Get-AppxPackage and its Appx module. As such, it won't work in PowerShell
15+
6 and later.
16+
17+
Instead of this script, consider using WinGet.exe.
18+
.LINK
19+
None
20+
.EXAMPLE
21+
PS > & 'Get AppX package names.ps1'
22+
23+
WARNING: Could not resolve the display name for 1527c705-839a-4832-9118-54d4Bd6a0c89.
24+
25+
Name DisplayName
26+
---- -----------
27+
1527c705-839a-4832-9118-54d4Bd6a0c89
28+
40459File-New-Project.EarTrumpet EarTrumpet
29+
48548MarcinOtorowski.MSIXHero MSIX Hero
30+
58027.265370AB8DB33 Character Map UWP
31+
64360VelerSoftware.DevToys DevToys
32+
c5e2524a-ea46-4f67-841f-6a9465d9d515 File Explorer
33+
E2A4F912-2574-4A75-9BB0-0D023378592B App Resolver
34+
F46D4000-FD22-4DB4-AC8E-4E1DDDE828FE Add Folder Suggestions dialog
35+
Microsoft.136853439117B Ink Journal
36+
Microsoft.AAD.BrokerPlugin Work or school account
37+
Microsoft.AccountsControl Email and accounts
38+
Microsoft.BioEnrollment Windows Hello Setup
39+
Microsoft.ECApp Eye Control
40+
Microsoft.Win32WebViewHost Desktop App Web Viewer
41+
Microsoft.Windows.Apprep.ChxApp Windows Defender SmartScreen
42+
Microsoft.Windows.CloudExperienceHost Your account
43+
Microsoft.Windows.ContentDeliveryManager Microsoft Content
44+
Microsoft.Windows.PeopleExperienceHost Windows Shell Experience
45+
Microsoft.Windows.SecHealthUI Windows Security
46+
Microsoft.Windows.SecureAssessmentBrowser Take a Test
47+
Microsoft.Windows.ShellExperienceHost Windows Shell Experience
48+
Microsoft.Windows.StartMenuExperienceHost Start
49+
Microsoft.Windows.XGpuEjectDialog Safely Remove Device
50+
microsoft.windowscommunicationsapps Mail and Calendar
51+
Microsoft.XboxGamingOverlay Game Bar
52+
windows.immersivecontrolpanel Settings
53+
#>
54+
355
[CmdletBinding()]
456
param ()
557

@@ -53,8 +105,7 @@ $AppxSum = $AppxPackages.Count
53105
# Create an array to store Appx identities
54106
Class AppxIdentity {
55107
[ValidateNotNullOrEmpty()][string]$Name
56-
[string]$DisplayNameResolved
57-
[string]$DisplayNameRaw
108+
[string]$DisplayName
58109
}
59110
[AppxIdentity[]]$AppxIdentities = [AppxIdentity[]]::New($AppxSum)
60111

@@ -74,20 +125,20 @@ for ($i = 0; $i -lt $AppxSum; $i++) {
74125
#The display name is stored in the Registry
75126
If (Test-Path $AXF) {
76127
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 "Could not resolve the display name for $($AXN)."
82-
}
128+
$EncodedName = (Get-ItemProperty -Path $AXF -Name DisplayName).DisplayName
129+
if ($EncodedName -match '^@') {
130+
$AXI.DisplayName = [IndirectStrings]::GetIndirectString( $EncodedName )
131+
if ($AXI.DisplayName -eq '') {
132+
Write-Warning "Could not resolve the display name for $AXN."
133+
}
83134
} 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. $($AXN) has a bad display name."
135+
$AXI.DisplayName = $EncodedName
136+
if ($EncodedName -match '^ms-resource\:') {
137+
Write-Verbose "For the want of an `@, a kingdom is lost. $AXN has a bad display name."
87138
}
88139
}
89140
} catch {
90-
Write-Verbose "There are no display names associated with $($AXN)."
141+
Write-Verbose "There are no display names associated with $AXN."
91142
}
92143
}
93144

AppX/Reinstall AppX Packages.ps1

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
#Requires -Version 5.1
2+
3+
<#
4+
.SYNOPSIS
5+
Re-registers all packaged apps by Microsoft Corporation for the current user.
6+
.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.
9+
.NOTES
10+
DEPRECATED
11+
12+
This script depends on Get-AppxPackage and its Appx module. As such, it won't work in PowerShell
13+
6 and later.
14+
.LINK
15+
None
16+
#>
17+
118
$MicrosoftPublisherIDs = @(
219
"cw5n1h2txyewy", # CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
320
"8wekyb3d8bbwe" # CN=Microsoft Windows, O=Microsoft Corporation, L=Redmond, S=Washington, C=US

AppX/Remove AppX packages.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,26 @@
1+
#Requires -Version 5.1
2+
3+
<#
4+
.SYNOPSIS
5+
Uninstalls certain packaged apps for the current user.
6+
.DESCRIPTION
7+
When Windows 10 was first published in 2015, it was bloated with marginally useful AppX packages.
8+
To their credit, they had no performance impact. Yet, their very existence was a violation of the
9+
principle of lean systems.
10+
11+
This script uninstalls them all for the current user. The script requires no administrative
12+
privileges.
13+
.NOTES
14+
DEPRECATED
15+
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.
20+
.LINK
21+
None
22+
#>
23+
124
Import-Module -Name Appx -ErrorAction Stop
225

326
$applist = @(

AppX/Repair system AppX packages.ps1

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
#Requires -RunAsAdministrator
2+
#Requires -Version 5.1
3+
4+
<#
5+
.SYNOPSIS
6+
Re-registers all packaged apps marked as System Components for the current user.
7+
.DESCRIPTION
8+
Looks for all mainline packaged apps installed in "SystemApp". Re-registers them for the current
9+
user.
10+
.NOTES
11+
DEPRECATED
12+
13+
This script depends on Get-AppxPackage and its Appx module. As such, it won't work in PowerShell
14+
6 and later.
15+
16+
This script is no longer necessary, thanks to Windows 10 quality having reached acceptable levels
17+
after nine years.
18+
.LINK
19+
None
20+
#>
21+
222
Get-AppxPackage -AllUsers | Where-Object InstallLocation -Like "*SystemApp*" | ForEach-Object {
323
$a=$_
424
Format-List -InputObject $a -Property Name,InstallLocation

BITS/Get all BITS jobs, custom.ps1

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,29 @@
11
#Requires -RunAsAdministrator
22

3-
$OutputTemplate1 = @'
4-
{0}
5-
{1}
6-
{2} | {3} | {4}
7-
{5:N0} / {6:N0}
8-
Files:
9-
'@
3+
# TO DO: Rewrite using list view
104

11-
$OutputTemplate2 =@'
5+
function Main {
6+
$OutputTemplate1 = "{0}`n{1}`n{2} | {3} | {4}`n{5:N0} / {6:N0}`nFiles:"
7+
$OutputTemplate2 = " Remote Name: {0}`n Local Name: {1}`n Progress: {2:N0} / {3:N0} ({4})"
8+
$SplitterLine = [String]::new([char]0x2500, 110)
129

13-
Remote Name: {0}
14-
Local Name: {1}
15-
Progress: {2:N0} / {3:N0} ({4})
16-
'@
10+
# The following only works in PowerShell 7.x:
11+
# $SplitterLine = [String]::new("`u{2500}", 110)
1712

18-
$SplitterLine = [String]::new([char]0x2500, 110)
19-
20-
# The following only works in PowerShell 7.x:
21-
# $SplitterLine = [String]::new("`u{2500}", 110)
22-
23-
function Public_Static_Void_Main {
13+
$a = Get-BitsTransfer -AllUsers -ErrorAction Stop
14+
if ($null -eq $a) {
15+
Write-Output "Found no BITS jobs."
16+
break
17+
}
2418
Write-Output $SplitterLine
25-
Get-BitsTransfer -AllUsers -ErrorAction Stop | ForEach-Object {
26-
$a=$_
27-
Write-Output $($OutputTemplate1 -f $a.JobId,$a.DisplayName,$a.TransferType,$a.JobState,$a.Priority,$a.BytesTransferred,$a.BytesTotal)
28-
ForEach-Object -InputObject $a.FileList {
29-
if ($_.IsTransferComplete) { $b = "Complete" } else { $b = "Pending" }
30-
Write-Output $($OutputTemplate2 -f $_.RemoteName,$_.LocalName,$_.BytesTransferred,$_.BytesTotal,$b)
31-
}
32-
Write-Output $SplitterLine
19+
$a | ForEach-Object {
20+
Write-Output $($OutputTemplate1 -f $_.JobId, $_.DisplayName, $_.TransferType, $_.JobState, $_.Priority, $_.BytesTransferred, $_.BytesTotal)
21+
ForEach-Object -InputObject $_.FileList {
22+
if ($_.IsTransferComplete) { $b = "Complete" } else { $b = "Pending" }
23+
Write-Output $($OutputTemplate2 -f $_.RemoteName, $_.LocalName, $_.BytesTransferred, $_.BytesTotal, $b)
24+
}
25+
Write-Output $SplitterLine
3326
}
3427
}
3528

36-
Public_Static_Void_Main
29+
Main

Changelog.markdown

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Change log
22

3+
## February 2024
4+
5+
Added:
6+
7+
- **Update management\Install updates with Wusa.exe.ps1:** Scans the current folder and all its subfolders for `.msu` files and invokes Windows Update Standalone Installer to install them all.
8+
9+
Remove:
10+
11+
- **Maintenance\Repair Windows.ps1:** This script proved more difficult than I had anticipated. I never had time to finish it.
12+
13+
Changed:
14+
15+
- **AppX\Get AppX package names.ps1:** Added help contents
16+
- **AppX\Reinstall AppX Packages.ps1:** Added help contents
17+
- **AppX\Remove AppX packages.ps1:** Added help contents
18+
- **AppX\Repair system AppX packages.ps1:** Added help contents
19+
- **BITS\Get all BITS jobs, custom.ps1:** Revised
20+
- **Maintenance\Clean compatibility store.ps1:** Added help contents
21+
- **Maintenance\Find broken services.ps1:** Trivial whitespace changes
22+
- **Maintenance\Repair all volumes.ps1:** Added help contents
23+
324
## November 2023
425

526
Changed (minor):

Maintenance/Clean compatibility store.ps1

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
#Requires -Version 5.1
22

3+
<#
4+
.SYNOPSIS
5+
Remove all local paths from the compatibility store.
6+
.DESCRIPTION
7+
The application compatibility database can potentially record paths of every .exe file ever run on
8+
your PC. This is a necessity of the PC ecosystem. However, users ocassionally need to start fresh.
9+
This script empties the compatibility store.
10+
11+
Unless you know what you are doing, don't run this script.
12+
#>
13+
314
using namespace System.Management.Automation
415

516
[CmdletBinding(SupportsShouldProcess)]

Maintenance/Find broken services.ps1

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
param (
44
)
55

6-
<#
7-
.SYNOPSIS
8-
Extracts the .exe path from the BinaryPathName property of a System.ServiceProcess.ServiceController object
9-
#>
106
function ExtractServiceExePath {
7+
<#
8+
.SYNOPSIS
9+
Extracts the .exe path from the BinaryPathName property of a System.ServiceProcess.ServiceController object
10+
#>
1111
param (
1212
# Supply a valid service invocation string, preferrably from the BinaryPathName property of a System.ServiceProcess.ServiceController object.
1313
[Parameter(Position = 0, Mandatory)]
@@ -22,11 +22,11 @@ function ExtractServiceExePath {
2222
}
2323
}
2424

25-
<#
26-
.SYNOPSIS
27-
Generates a list of Windows services consisting of their names, display names, command-line invocations, and binary file paths.
28-
#>
2925
function Get-ServicePath {
26+
<#
27+
.SYNOPSIS
28+
Generates a list of Windows services consisting of their names, display names, command-line invocations, and binary file paths.
29+
#>
3030
[CmdletBinding()]
3131
param (
3232
)
@@ -38,11 +38,11 @@ function Get-ServicePath {
3838
@{ label = "Path"; e = { ExtractServiceExePath ($_.BinaryPathName) } }
3939
}
4040

41-
<#
42-
.SYNOPSIS
43-
Generates a list of broken Windows services whose binary file path is invalid.
44-
#>
4541
function Find-BrokenService {
42+
<#
43+
.SYNOPSIS
44+
Generates a list of broken Windows services whose binary file path is invalid.
45+
#>
4646
[CmdletBinding()]
4747
param (
4848
)

Maintenance/Repair Windows.ps1

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)