I built a simple GUI powershell script that runs exactly how I want it on many different computers (after installing all the right modules I also tried installing them with the -scope allusers).
when I compile the script using ps2exe it throws errors as if I haven't installed some of the modules I can use on the computer.
I also made sure to import the modules at the top of the script.
I assume this has something todo with scope but I am not sure how to configure the module/exe to be able to see Az.Accounts
Note: the powershell module sqlserver seems to work just fine no issues for the exe to find and use that one.
Edit: I just tested the script with no code other than just importing the module Az.Accounts and Connect-AzAccount. again this script runs just fine before converting with ps2exe