Fix “orphaned” AppX apps from Windows 8 and Windows RT

It might be possible to get into a state where you can’t search for an app on Start, yet the Store insists that “You own this app.” Since the app isn’t shown on Start, there isn’t an entry point to uninstall it within the UI. We can use PowerShell to locate the package and remove it, then reinstall from the Store.

Box.net search results in Windows 8 - the app is not found

Box product page in the Windows Store - You own this appHere’s a PowerShell script to fix an app that gets into this state:

function Get-OrphanedAppxPackage
{
    # Ignore frameworks, WinStore and control panel
    Get-AppxPackage | ? IsFramework -eq $false | ? InstallLocation -notlike "*:\Windows\*" | % { 
        $AppShortcutsAppFolder = "$env:LOCALAPPDATA\Microsoft\Windows\Application Shortcuts\$($_.PackageFamilyName)"
        if ((-Not (Test-Path $AppShortcutsAppFolder)) -or ((ls $AppShortcutsAppFolder).Count -eq 0)) 
        {
            $_
        }
    }
}

Simply run Get-OrphanedAppxPackage:

Get-OrphanedAppxPackage | Remove-AppxPackageNow when visiting the Store, the app can be reinstalled:

Box can not be installed from the Windows Store

October 31, 2012