I'm currently writing a powershell script which upgrades a set of solutions then a set of features from those solutions.
After the solution upgrades everything looks great until I Call QueryFeatures which proceeds to return an empty result set.
# This is just sample code
$site.QueryFeatures((Get-SPFeature | Where { $_.DisplayName -match "$FeatureName" } | Select -First 1).Id, $true)
I've tried disposing the site before use then creating a new site with new-object, and even Clearing the Object Model Cache. The only thing that works is to open a new powershell window and issuing the same command.
However this is part of a long running script so this obviously isn't the best solution. Has anyone run into this issue before?