Server Man
Well-Known Member
- May 17, 2015
- Windows 10
- Chrome 67.0.3396.99
My name is Benjamin Morgan and today I want to discuss the AppxPackages in Windows 10. Recently I had a customer looking at upgrading to Windows 10 1803 and they sent me a list of apps that they wanted to remove and asked what other apps could be removed as well. We have a list of typical apps located at Windows 10 - Apps, but the list does not include everything. To meet my customers’ requirement, I had to resort to writing my own PowerShell script to get them all the information that they needed. When I looked at the properties of one of the apps, ‘Get-AppxPackage -AllUsers *sol*’, I noticed the following, the “SignatureKind” was marked as “Store”
I ran the same command against Edge since I knew that was part of the OS and cannot be removed, so I wanted to see what the deltas were between an App that could be removed and one that cannot be removed. Running ‘Get-AppxPackage -AllUsers *edge*’ I noticed that “SignatureKind” was marked as “System”
Based upon this finding I made the hypothesis that any App marked as “Store” could be removed while an App marked as “System” would not be able to be removed. The next issue I saw was that not every App product name was the actual name of the App when looking through the Start menu I needed a way to marry the name of the AppxPackage with the actual product name of the App. Since PowerShell gives the location of the App’s installation directory I decided to parse that directory for .exe files and then pull the name of the App off that .exe file. The sample script that I used to create a test file that showed all the removable AppxPackages is:
<#Disclaimer:
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages. #>
######### Create Variables ################
$appxpackages = Get-AppxPackage -AllUsers | % {if($_.SignatureKind -eq “store”){$_.name}}
$output = “$env:USERPROFILEdesktopappxpackages.txt”
######### Get All AppxPackges That Are Removable ################
foreach ($app in $appxpackages){
######### Get The Location Of The AppxPackage ################
foreach ($location in (Get-AppxPackage -name $app).InstallLocation){
######### Get The Executable Files Of The AppxPackage ################
$exes = Get-Childitem $location *.exe -Recurse
######### Get Each Individual Executable File Of The AppxPackage ################
foreach ($exe in $exes){
######### Get The Name Executable File Of The AppxPackage ################
$name = ($exe).name
######### Verify Accesabiliy To The Executable File Of The AppxPackage ################
$testpath = Test-Path “$location$name“
if ($testpath -eq $true){
foreach ($n in $name) {
######### Get The Application Name Of The Executable File Of The AppxPackage ################
$appname = (Get-Item “$location$name“).versioninfo.productname
if ($appname -ne $null){
######### Output The Application Name And AppxPackage Name To The User’s Desktop ################
if ($appname -ne “”){
“Application Name: $appname“| Out-File $output -NoClobber -Append
“AppxPackage Name: $app” | Out-File $output -NoClobber -Append
“———————————-” | Out-File $output -NoClobber -Append
}
}
}
}
}
}
}
Using this script, I was able to give my customer the ability to create a text file to view the application product names and the AppxPackage name all the AppxPackages that are removable. This script has only been tested with Windows 10 1709 and Windows 10 1803, as it incorporates several items that were first introduced in Windows 10 1709.
Hopefully this helps you to understand and manage your own Appx packages. Thanks for reading!
Continue reading...
I ran the same command against Edge since I knew that was part of the OS and cannot be removed, so I wanted to see what the deltas were between an App that could be removed and one that cannot be removed. Running ‘Get-AppxPackage -AllUsers *edge*’ I noticed that “SignatureKind” was marked as “System”
Based upon this finding I made the hypothesis that any App marked as “Store” could be removed while an App marked as “System” would not be able to be removed. The next issue I saw was that not every App product name was the actual name of the App when looking through the Start menu I needed a way to marry the name of the AppxPackage with the actual product name of the App. Since PowerShell gives the location of the App’s installation directory I decided to parse that directory for .exe files and then pull the name of the App off that .exe file. The sample script that I used to create a test file that showed all the removable AppxPackages is:
<#Disclaimer:
The sample scripts are not supported under any Microsoft standard support program or service. The sample scripts are provided AS IS without warranty of any kind. Microsoft further disclaims all implied warranties including, without limitation, any implied warranties of merchantability or of fitness for a particular purpose. The entire risk arising out of the use or performance of the sample scripts and documentation remains with you. In no event shall Microsoft, its authors, or anyone else involved in the creation, production, or delivery of the scripts be liable for any damages whatsoever (including, without limitation, damages for loss of business profits, business interruption, loss of business information, or other pecuniary loss) arising out of the use of or inability to use the sample scripts or documentation, even if Microsoft has been advised of the possibility of such damages. #>
######### Create Variables ################
$appxpackages = Get-AppxPackage -AllUsers | % {if($_.SignatureKind -eq “store”){$_.name}}
$output = “$env:USERPROFILEdesktopappxpackages.txt”
######### Get All AppxPackges That Are Removable ################
foreach ($app in $appxpackages){
######### Get The Location Of The AppxPackage ################
foreach ($location in (Get-AppxPackage -name $app).InstallLocation){
######### Get The Executable Files Of The AppxPackage ################
$exes = Get-Childitem $location *.exe -Recurse
######### Get Each Individual Executable File Of The AppxPackage ################
foreach ($exe in $exes){
######### Get The Name Executable File Of The AppxPackage ################
$name = ($exe).name
######### Verify Accesabiliy To The Executable File Of The AppxPackage ################
$testpath = Test-Path “$location$name“
if ($testpath -eq $true){
foreach ($n in $name) {
######### Get The Application Name Of The Executable File Of The AppxPackage ################
$appname = (Get-Item “$location$name“).versioninfo.productname
if ($appname -ne $null){
######### Output The Application Name And AppxPackage Name To The User’s Desktop ################
if ($appname -ne “”){
“Application Name: $appname“| Out-File $output -NoClobber -Append
“AppxPackage Name: $app” | Out-File $output -NoClobber -Append
“———————————-” | Out-File $output -NoClobber -Append
}
}
}
}
}
}
}
Using this script, I was able to give my customer the ability to create a text file to view the application product names and the AppxPackage name all the AppxPackages that are removable. This script has only been tested with Windows 10 1709 and Windows 10 1803, as it incorporates several items that were first introduced in Windows 10 1709.
Hopefully this helps you to understand and manage your own Appx packages. Thanks for reading!
Continue reading...