0
votes

I have a program that is used for creating O365 Content Searches using the ExchangeOnlineManagement module. Trying to get this to work for MFA.

When the operation is ran from the program it calls a ps1 file and run the Connect-IPPSSession command it fails saying the module is not loaded. This is true for any command from this module and I cannot load this module in this script either.

When I run PS as an admin and use the Get-InstalledModule PS command to get the modules installed I get:

1.0.1 ExchangeOnlineManagement PSGallery This is a General Availability (GA) release of Exchange Online PowerShell V2 module....

When I run PS as any other user and run the Get-InstalledModule command I get the same thing. So I know that I have this module loaded and installed successfully for all users.

If I use the PS ISE and run the script I am calling from my program from any user it runs just fine.

Now, here is the kicker, if I leave the PS session window open from when the program operation opens it and try the Get-InstalledModule command it cannot find the module. Nor can I install, or import the module by name, path, even trying the loading the Microsoft.Exchange.Management.ExoPowershellModule.dll. Nothing allows this module to load from this PS session

modified I think that I can ask this problem another way and get better answers. Since I am in fact running PowerShell from a Shell session this may change things on how Powershell works, though I don't know how.

So how do you install or call Powershell modules that are available from Powershell running in a shell session or Any ideas on how to load this module to work.

Thanks

Show the result of the different PS sessions

1
Does $env:PSModulePath match in both sessions? Where is the actual module located? You can find this with Get-Module ExchangeOnlineManagement | Select-Object PathCrookedJ
Yes. The path for each session is: C:\Program Files\WindowsPowerShell\Modules\ExchangeOnlineManagement\1.0.1\ExchangeOnlineManagement.psm1tegnatomm

1 Answers

0
votes

I have the answer.

The ExchangeOnlineManagement requires 64 bit. Found that the Shell session was 32 still.

Once I called the correct Shell Session everything worked.