Forum Discussion
Find app installed in PC
I just want to write a script will check that any of the following script is running or not. i tried what you suggested and still it is not working properly. Here is my
ForEach($App in $AppsList) {
$software = (Get-AppxPackage -allusers $App).PackageFullName
$installed = (Get-ProvisionedAppxPackage -online | Where {$_.DisplayName -eq $software}) -ne $null
if ($installed) {
Write-Host "'$App' not found.";
} else {
Write-Host "'$App' found."
}
}
For starters the PackageFullName property is different from the DisplayName one, so you should not be comparing them directly. The Get-ProvisionedAppxPackage lists apps that are included in the windows image, not necessarily ones that are installed. If you only care about the installed ones, use just Get-AppxPackage, which will cover any app, regardless of the source it was installed from (as mentioned above, some will be directly downloaded from the internet).
- DeletedJul 03, 2018
Hi VasilMichev
As you said i am using only get-Appxpackage but still its not working how it suppose to work. i have a list of package which need to be find apps is installed in pc but some application is not installed and it still says it is installed.
$PackageFullName = (Get-AppxPackage -allusers $App).PackageFullNamewrite-host $PackageFullNameif ($PackageFullName){Write-Host "Removing Package: $App"}else{Write-Host "Unable to find package: $App"}- DeletedJul 03, 2018Here is the update code
$PackageFullName = (Get-AppxPackage -allusers $App).PackageFullName
write-host $PackageFullName
if ($PackageFullName)
{
Write-Host "Package found : $App"
}
else
{
Write-Host "Unable to find package: $App"
}- MB_SmithAug 05, 2018Iron Contributor
As Vasil wrote, don't use PackageFullname. Use DisplayName.
Here is a script I run during computer deployment:
[CmdletBinding()]Param()#### Remove everything but StickyNotes, Paint, Photos, Calc#### Michael B. Smith## April 4, 2018## michael@smithcons.com#### No warranties, etc. etc.#### Somewhat based on#### But do NOT do a 'Get-AppxPackage | Remove-AppxPackage -AllUsers'.## You will break Windows.#### The initial posting on this topic from Michael Niehaus in 2015:##$keepers = @('Microsoft.MicrosoftStickyNotes','Microsoft.MSPaint','Microsoft.Windows.Photos','Microsoft.WindowsCalculator','Microsoft.StorePurchaseApp','Microsoft.WindowsStore')$packages = Get-AppxProvisionedPackage -Onlineforeach( $package in $packages ){if( $keepers -contains $package.DisplayName ){Write-Verbose "Will NOT remove $( $package.DisplayName )"}else{Write-Verbose "WILL remove $( $package.DisplayName )"Write-Verbose "PackageFullName $( $package.PackageName )"Remove-AppxPackage -Package $package.PackageName -AllUsers -VerboseRemove-AppxProvisionedPackage -Online -PackageName $package.PackageName -Verbose -ErrorAction SilentlyContinue}}$packages = $null