It does generate an EXE. But since getting this .Net error I am seeing very strange behavior.
If I execute the EXE from within PSScriptPad, everything works fine. There is no background PowerShell window opened, just the form and all functions work.
When I close that and directly runt he EXE, a PowerShell window opens when the script loads modules. That then shows errors loading the MSOnline module.
The module loads fine via PSScritpPad and in a PowerShell window directly. The errors I am getting are:
Import-Module : Could not load file or assembly ‘file:///C:\Program
Files\WindowsPowerShell\Modules\MSOnline\22.214.171.124\Microsoft.Online.Administration.Automation.PSModule.dll’ or one of
its dependencies. An attempt was made to load a program with an incorrect format.
At line:38 char:2
- CategoryInfo : InvalidOperation: ( [Import-Module], BadImageFormatException
- FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
Connect-MsolService : The ‘Connect-MsolService’ command was found in the module ‘MSOnline’, but the module could not
be loaded. For more information, run ‘Import-Module MSOnline’.
At line:39 char:2
Get-MsolUser : The ‘Get-MsolUser’ command was found in the module ‘MSOnline’, but the module could not be loaded. For
more information, run ‘Import-Module MSOnline’.
At line:40 char:13
I don’t understand why it would work properly in PSScriptPad but not when executed directly in the EXE.