Ensure Appx is run under powershell 5.x to avoid compatibility issues in modern systems#172
Ensure Appx is run under powershell 5.x to avoid compatibility issues in modern systems#172theCrius wants to merge 2 commits intoBrianLima:masterfrom
Conversation
…powershell-5-to-avoid-compatibility-issues Ensure the Appx module is run via powershell 5
|
With this is it working again? |
|
I assume so, I can't recall the extent of my testing as it's been too long ago. The code change is really simple: everything in the script is put into a function and if the powershell version on the system is detected to be 7 or higher, the function is instead run using powershell 5. If not, it's run as is. Probably easier to read the change in diff view rather than the default inline view. https://github.com/BrianLima/UWPHook/pull/172/files?diff=split&w=0 The output I wrote above is by calling directly the script. Which, in the current version, simply fail to execute instead. |
Running the application in modern system or with a system that have PowerShell 7.x installed as default, will generate an error when trying to list the games.
This change will simply run the exact same logic, but first check what PowerShell is running into. If it's in PowerShell 7.x, it will instead explicitly invoke PowerShell 5.x to maintain the functionality.
You can easily test this by:
masterbranch of the projectUWPHook\Resources\GetAUMIDScript.ps1and runYou'll see this error:
If you instead try to run the version I have updated, you'll see the list of games retrieved. For example:
Which I assume is the expected result.