I have 2 Powershell scripts and they both work really well – but I now want to combine them and am not sure how to go about it.
The first script is (this provides details of apps installed from the Store):
Get-AppxPackage | Select Name, InstallLocation, PackageFamilyName, Target
The second script is (which provides the application id – which is required to launch the app through code):
(Get-AppxPackage -Name "*ADD PACKAGE NAME*" | Get-AppxPackageManifest).package.applications.application.id
If possible – I’d either want the above combined in one script where the application id could be appended to an additional column – or I’d like the first script to feed/input the second script.
>Solution :
# Get packages and select needed properties
$packages = Get-AppxPackage | Select Name, InstallLocation, PackageFamilyName, Target
# add foreach through each package
foreach ($package in $packages) {
$appName = $package.Name
$appId = (Get-AppxPackage -Name $appName | Get-AppxPackageManifest).package.applications.application.id
# Set the Application ID to the object as a new
$package | Add-Member -MemberType NoteProperty -Name "ApplicationId" -Value $appId
}
# Output (combined result)
$packages