Module Initialize Error on 24h2
I have converted a powershell script to an exe inside of this script another powershell script runs that imports a module with functions.
When running any functions in this module that have "Get-AppxPackage" in them an error happens
If I use the script without converting to an exe everything works normally
Hello @zoicware,
I guess the error has something to do with Powershell Core. What version of Powershell do you use to compile the script with PS2EXE - PS2EXE works only with Powershell 5.x. How do you call the second Powershell script and what module fails and how and where do you load it? Does this script work on a pre 24h2 computer?
Greetings
Markus
Im using 5.1 Yes it works on any other version except for 24h2. I was able to fix it by just switching the script to batch and compiling that to an exe (code here - https://github.com/zoicware/ZOICWARE/blob/main/src/RUN%20ZOICWARE.bat) This was compiled with the bat2exe tool (Win32 Cabinet Self-Extractor file)
Ill try to summarize the workflow RUN ZOICWARE is ran which then searches for zoicware.ps1 and runs this script like &$script, then that script sets up some things like importing a module in order to use the functions from it. When running any function from this module that has get-appxpackage the error happens as well as any other script ran from this powershell compiled exe.
Hello @zoicware,
I still cannot reproduce your error. But you seem to have found a solution - that's fine.
Greetings
Markus
Hello @zoicware,
seems to be an error with Win11 24H2, see here https://www.reddit.com/r/PowerShell/comments/1g03x2u/getappxpackage_error_24h2/ or here https://community.flexera.com/t5/InstallShield-Forum/Failed-to-remove-appx-in-Installshield-Powershell-script-in-OS/m-p/312600 or here https://www.dell.com/community/en/conversations/image-assist/image-assist-11114-not-working-with-new-windows-11-24h2-pro/66fdbc879983c060015c50bc
Greetings
Markus
Hello @zoicware,
seems to be an error with Win11 24H2, see here https://www.reddit.com/r/PowerShell/comments/1g03x2u/getappxpackage_error_24h2/ or here https://community.flexera.com/t5/InstallShield-Forum/Failed-to-remove-appx-in-Installshield-Powershell-script-in-OS/m-p/312600 or here https://www.dell.com/community/en/conversations/image-assist/image-assist-11114-not-working-with-new-windows-11-24h2-pro/66fdbc879983c060015c50bc
Greetings
Markus
ah yep looks like i was just ahead haha! 24h2 is quite buggy so no surprise here.
No PS2EXE issue