Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module Initialize Error on 24h2 #137

Open
zoicware opened this issue Oct 2, 2024 · 5 comments
Open

Module Initialize Error on 24h2 #137

zoicware opened this issue Oct 2, 2024 · 5 comments

Comments

@zoicware
Copy link

zoicware commented Oct 2, 2024

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
image

If I use the script without converting to an exe everything works normally

@MScholtes
Copy link
Owner

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

@zoicware
Copy link
Author

zoicware commented Oct 5, 2024

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.

@MScholtes
Copy link
Owner

Hello @zoicware,

I still cannot reproduce your error. But you seem to have found a solution - that's fine.

Greetings

Markus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants