SOLVED

Problem with Exchange online Powershell

%3CLINGO-SUB%20id%3D%22lingo-sub-2005475%22%20slang%3D%22en-US%22%3EProblem%20with%20Exchange%20online%20Powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2005475%22%20slang%3D%22en-US%22%3E%3CP%3EGreetings.%20%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20trying%20to%20connect%20to%20exchange%20online%20(o365)%2C%20I'm%20getting%20this%20message%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3EImport-PSSession%20%3A%20Files%20cannot%20be%20loaded%20because%20running%20scripts%20is%20disabled%20on%20this%20system.%20Provide%20a%20valid%26nbsp%3Bcertificate%20with%20which%20to%20sign%20the%20files.%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3EAt%20C%3A%5CProgram%20files%5CWindowsPowerShell%5CModules%5CExchangeOnlineManagement%5C2.0.3%5CExchangeOnlineManagement.psm1%3A435%20char%3A40%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%2B%20...%20oduleInfo%20%3D%20Import-PSSession%20%24PSSession%20-AllowClobber%20-DisableNameChe%20...%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%2B%20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%2B%20CategoryInfo%20%3A%20InvalidOperation%3A%20(%3A)%20%5BImport-PSSession%5D%2C%20PSInvalidOperationException%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E%2B%20FullyQualifiedErrorId%20%3A%20InvalidOperation%2CMicrosoft.PowerShell.Commands.ImportPSSessionCommand%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20on%20a%20VM%20I%20built%20on%20Azure.%20Simple%20Windows%2010%20Env.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20command%20I%20used%3A%3C%2FP%3E%3CP%3E%3CSTRONG%3EConnect-ExchangeOnline%20-ConnectionUri%20%22%3CA%20href%3D%22https%3A%2F%2Foutlook.office365.com%2Fpowershell-liveid%3FSerializationLevel%3DFull%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Foutlook.office365.com%2Fpowershell-liveid%3FSerializationLevel%3DFull%3C%2FA%3E%22%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20something%20I'm%20missing%20on%20the%20configuration%20of%20the%20VM%3F%20%26nbsp%3BI%20am%20running%20PWSH%20in%20Admin%20mode.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ENote%3A%26nbsp%3B%20I%20updated%20to%207.1%20and%20I%20now%20get%20the%20error%20shown%20in%20the%20screen%20grab%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22Screen%20Shot%202020-12-20%20at%205.29.25%20PM.jpg%22%20style%3D%22width%3A%20999px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F241995i351DABB848AAB949%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22Screen%20Shot%202020-12-20%20at%205.29.25%20PM.jpg%22%20alt%3D%22New%20Error%20with%20PS%207.1%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ENew%20Error%20with%20PS%207.1%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2005475%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%20Online%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Contributor

Greetings.  

 

When trying to connect to exchange online (o365), I'm getting this message:

Import-PSSession : Files cannot be loaded because running scripts is disabled on this system. Provide a valid certificate with which to sign the files.
At C:\Program files\WindowsPowerShell\Modules\ExchangeOnlineManagement\2.0.3\ExchangeOnlineManagement.psm1:435 char:40
+ ... oduleInfo = Import-PSSession $PSSession -AllowClobber -DisableNameChe ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-PSSession], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.ImportPSSessionCommand

 

I am on a VM I built on Azure. Simple Windows 10 Env.

 

The command I used:

Connect-ExchangeOnline -ConnectionUri "https://outlook.office365.com/powershell-liveid?SerializationLevel=Full"

 

Is there something I'm missing on the configuration of the VM?  I am running PWSH in Admin mode.

 

Any help appreciated.

 

Note:  I updated to 7.1 and I now get the error shown in the screen grab:

New Error with PS 7.1New Error with PS 7.1

 

2 Replies
Best Response confirmed by Rick Segal (Contributor)
Solution

The Exchange online PS module is not yet supported on PSCore/7.1, use good old Windows PowerShell instead. Apart from that, you seem to have the execution policy misconfigured, use Set-ExecutionPolicy to address that.

@Vasil Michev 

 

Thanks.  I got it working.

 

Rick