Avatar of yballan
yballan
Flag for United States of America asked on

Cannot connect using Connect-EXOPSSession

Dear Experts,

After following this instruction from Microsoft to how to install and use Exchange Online Powershell with MFA:
https://docs.microsoft.com/en-us/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/mfa-connect-to-exchange-online-powershell?view=exchange-ps
When I try the first command, which is:

Connect-EXOPSSession   -UserPrincipalName   yballan@yyyy.org

I receive the following error message:

Import-Module : The specified module 'Microsoft.Exchange.Management.ExoPowershellModule.dll' was not loaded because no valid module file was found in any module directory.

I have verified that there are indeed folders and files in what follows the error message:  C:\Users\yballan\AppData\Local\Apps\2.0\2TY3WBGZ.L3B\H6W6HB8Z.OK0

I am not sure why the module cannot be found.  
I have deleted the C:\Users\yballan\AppData\Local\Apps\2.0 folder and the short cut to Online Exchange Powershell and redownloaded and reinstalled several times, but I still cannot get this working.
Please advise.
PowershellExchange* mfa

Avatar of undefined
Last Comment
yballan

8/22/2022 - Mon
FOX

Yballan,
Did you go to your Exchange Admin Center for your site and download and install the Exchange online Module?

In Internet Explorer or Edge, open the Exchange admin center (EAC) for your Exchange Online organization (Google Chrome or Mozilla Firefox won't work). For instructions, see Exchange Admin Center in Exchange Online.

In the EAC, go to Hybrid > Setup and click the appropriate Configure button to download the Exchange Online Remote PowerShell Module for multi-factor authentication.
yballan

ASKER
Dear FOX, yes, I did download and install the Exchange online Module.
First I thought the problem was that I was not executing it as Administrator.  But there is no way for me to do it.
Only thing I can find is a shortcut, cannot find where the executable is located.
Please see my screenshot.

I am executing everything in this module, and still getting an error.
MSEOP-Screenshot.jpg
Jian An Lim

try this on a normal powershell (prefered with admin rights)


Import-Module $((Get-ChildItem -Path $($env:LOCALAPPDATA+"\Apps\2.0\") -Filter Microsoft.Exchange.Management.ExoPowershellModule.dll -Recurse ).FullName|?{$_ -notmatch "_none_"}|select -First 1)
$EXOSession = New-ExoPSSession
Import-PSSession $EXOSession

Open in new window

I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
yballan

ASKER
Dear Jian An Lim, thank you for a quick reply.  When I execute the first line, I get an error.  Please see attached.
EXOPScriptError.JPG
ASKER CERTIFIED SOLUTION
Jian An Lim

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
yballan

ASKER
Thank you, Jian An, I will perform the above as soon as I get to work tomorrow AM!!!!
Jian An Lim

also run

$env:LOCALAPPDATA

Open in new window


to confirm is this the same location on where your command prompt runs.

i am thinking you might use a different a admin account for powershell purpose hence cannot find the required dll
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
yballan

ASKER
Yes, I was able to run all of the commands without error.  Please see attached.

Both Get-ChildItem -Path did not give error, but also did not return anything.  is that what you are referring as Null?

I agree with you, I have been trying to locate Microsoft.Exchange.Management.ExoPowershellModule.dll myself.  I am trying to see who has this info.
PowerShell.JPG
yballan

ASKER
Dear Jian An,

When I went to find out who set this up, I was told one piece of information I was missing:  It doesn't run on Windows 7 Pro machine!!
I had no idea, since Win7 P laptop was what was given to me from my boss, I didn't even think to check.  I feel so dumb.

Thank you for guiding me to the right path, I RDP to Win2012 Server and tested and was able to get it working.

I really appreciated your help.
yballan

ASKER
I really appreciated your help!  Thank you.   yballan
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23