|
| 1 | +#Requires -Version 5.1 |
| 2 | +#Requires -PSEdition Desktop |
| 3 | +using namespace System.Management.Automation |
| 4 | +using namespace System.Management.Automation.Language |
| 5 | +<# |
| 6 | +.SYNOPSIS |
| 7 | + Provides a list of all installed UWP Appx apps on a Win10 or Win11 host. |
| 8 | +.DESCRIPTION |
| 9 | + Provides a list of all currently installed UWP Appx apps on a Win10 or Win11 host. Useful for OSD and standardiation in MDT / SCCM / Intune / etc. |
| 10 | + Must be run as an administrator. |
| 11 | +.PARAMETER |
| 12 | + --. |
| 13 | +.EXAMPLE |
| 14 | + get-UWP-Apps.ps1 |
| 15 | +.INPUTS |
| 16 | + None. |
| 17 | +.OUTPUTS |
| 18 | + List of apps in PS CLI + optional csv export of the app list. |
| 19 | +.NOTES |
| 20 | +Author: Julian West |
| 21 | + BSD 3-Clause License; |
| 22 | + - see License Region at-end of script for more information |
| 23 | + ________________________________________________ |
| 24 | + / \ |
| 25 | + | _________________________________________ | |
| 26 | + | | | | |
| 27 | + | | PS C:\ > WRITE-HOST $ATTRIBUTION | | |
| 28 | + | | | | |
| 29 | + | | THIS IS A J-DUB SCRIPT | | |
| 30 | + | | | | |
| 31 | + | | https://github.com/J-DubAppss | | |
| 32 | + | | | | |
| 33 | + | | julianwest.me | | |
| 34 | + | | @julian_west | | |
| 35 | + | | | | |
| 36 | + | | | | |
| 37 | + | | | | |
| 38 | + | | | | |
| 39 | + | | | | |
| 40 | + | |_________________________________________| | |
| 41 | + | | |
| 42 | + \_________________________________________________/ |
| 43 | + \___________________________________/ |
| 44 | + ___________________________________________ |
| 45 | + _-' .-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. --- `-_ |
| 46 | + _-'.-.-. .---.-.-.-.-.-.-.-.-.-.-.-.-.-.-.--. .-.-.`-_ |
| 47 | + _-'.-.-.-. .---.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-`__`. .-.-.-.`-_ |
| 48 | + _-'.-.-.-.-. .-----.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-----. .-.-.-.-.`-_ |
| 49 | + _-'.-.-.-.-.-. .---.-. .-------------------------. .-.---. .---.-.-.-.`-_ |
| 50 | + :-------------------------------------------------------------------------: |
| 51 | + `---._.-------------------------------------------------------------._.---' |
| 52 | +.LINK |
| 53 | + https://julianwest.me |
| 54 | +.LINK |
| 55 | + https://github.com/J-DubApps/PSScripts/blob/main/get-UWP-Installed.ps1 |
| 56 | +.COMPONENT |
| 57 | + -- |
| 58 | +.FUNCTIONALITY |
| 59 | + -- |
| 60 | +#> |
| 61 | +if ($ENV:PROCESSOR_ARCHITEW6432 -eq 'AMD64') { |
| 62 | + try { |
| 63 | + &"$ENV:WINDIR\SysNative\WindowsPowershell\v1.0\PowerShell.exe" -File $PSCOMMANDPATH |
| 64 | + } |
| 65 | + catch { |
| 66 | + Throw ('Failed to start {0}' -f $PSCOMMANDPATH) |
| 67 | + } |
| 68 | + |
| 69 | + exit |
| 70 | +} |
| 71 | +#endregion ARM64Handling |
| 72 | + |
| 73 | + |
| 74 | +# Initialize an empty array to hold the package information |
| 75 | +$installedUWPApps = @() |
| 76 | + |
| 77 | +# Get all installed Appx packages |
| 78 | +$allAppxPackages = Get-AppxPackage |
| 79 | + |
| 80 | +# Filter out only the UWP apps that are pre-installed |
| 81 | +foreach ($appx in $allAppxPackages) { |
| 82 | + if ($appx.Name -like "*Microsoft.*" -or $appx.Name -like "*windows*") { |
| 83 | + $installedUWPApps += $appx |
| 84 | + } |
| 85 | +} |
| 86 | + |
| 87 | +# Display the installed UWP apps |
| 88 | +$installedUWPApps | Select-Object Name, PackageFullName, InstallLocation | Format-Table -AutoSize |
| 89 | + |
| 90 | +# Optionally, you can export this information to a CSV file |
| 91 | +#$installedUWPApps | Select-Object Name, PackageFullName, InstallLocation | Export-Csv -Path "C:\Path\To\Save\installedUWPApps.csv" -NoTypeInformation |
| 92 | + |
| 93 | +exit 0 |
| 94 | + |
| 95 | +#region LICENSE |
| 96 | +<# |
| 97 | + BSD 3-Clause License |
| 98 | +
|
| 99 | + Copyright (c) 2023, Julian West |
| 100 | + All rights reserved. |
| 101 | +
|
| 102 | + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: |
| 103 | + 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. |
| 104 | + 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. |
| 105 | + 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. |
| 106 | +
|
| 107 | + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 108 | +#> |
| 109 | +#endregion LICENSE |
| 110 | + |
| 111 | +#region DISCLAIMER |
| 112 | +<# |
| 113 | + DISCLAIMER: |
| 114 | + - Use at your own risk, etc. |
| 115 | + - This is open-source software, if you find an issue try to fix it yourself. There is no support and/or warranty in any kind |
| 116 | + - This is a third-party Software |
| 117 | + - The developer of this Software is NOT sponsored by or affiliated with Microsoft Corp (MSFT) or any of its subsidiaries in any way |
| 118 | + - The Software is not supported by Microsoft Corp (MSFT) |
| 119 | + - By using the Software, you agree to the License, Terms, and any Conditions declared and described above |
| 120 | + - If you disagree with any of the Terms, and any Conditions declared: Just delete it and build your own solution |
| 121 | +#> |
| 122 | +#endregion DISCLAIMER |
0 commit comments