Powershell Console fails to load modules
Posted: Sun Sep 12, 2021 4:05 pm
Receiving errors when launching POSH shell from plugin.
Copyright (C) Microsoft Corporation. All rights reserved.
Opening up a connection to Office365
import-module : Could not load file or assembly 'file:///C:\Program
Files\WindowsPowerShell\Modules\MSOnline\1.1.183.57\Microsoft.Online.Administration.Automation.PSModule.dll' or one of
its dependencies. An attempt was made to load a program with an incorrect format.
At C:\temp\Office365\Office365_Plugin.ps1:26 char:1
+ import-module MSOnline
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Import-Module], BadImageFormatException
+ FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
Importing modules from Office365
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 C:\temp\Office365\Office365_Plugin.ps1:36 char:2
+ Connect-Msolservice -cred $cred -ea silentlyContinue -WarningActi ...
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Connect-Msolservice:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
Importing modules from Sharepoint
Connect-SPOService : Cannot contact web site 'https://dibtec-admin.sharepoint.com/' or the web site does not support
SharePoint Online credentials. The response status code is 'Unauthorized'. The response headers are
'X-SharePointHealthScore=2, X-MSDAVEXT_Error=917656; Access+denied.+Before+opening+files+in+this+location%2c+you+must+f
irst+browse+to+the+web+site+and+select+the+option+to+login+automatically.,
SPRequestGuid=af2ded9f-d097-1000-14ec-6e68101e869b, request-id=af2ded9f-d097-1000-14ec-6e68101e869b,
MS-CV=n+0tr5fQABAU7G5oEB6Gmw.0, Strict-Transport-Security=max-age=31536000, SPRequestDuration=27, SPIisLatency=0,
MicrosoftSharePointTeamServices=16.0.0.21625, X-Content-Type-Options=nosniff, X-MS-InvokeApp=1; RequireReadOnly,
X-Cache=CONFIG_NOCACHE, X-MSEdge-Ref=Ref A: 70841630C9814928B648DFB025F4FEFC Ref B: BLUEDGE1309 Ref C:
2021-09-07T14:34:02Z, Content-Length=0, Content-Type=text/plain; charset=utf-8, Date=Tue, 07 Sep 2021 14:34:02 GMT,
P3P=CP="ALL IND DSP COR ADM CONo CUR CUSo IVAo IVDo PSA PSD TAI TELo OUR SAMo CNT COM INT NAV ONL PHY PRE PUR UNI",
X-Powered-By=ASP.NET'.
At C:\temp\Office365\Office365_Plugin.ps1:43 char:3
+ Connect-SPOService -Url $SharePointURL -credential $credentia ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Connect-SPOService], NotSupportedException
+ FullyQualifiedErrorId : System.NotSupportedException,Microsoft.Online.SharePoint.PowerShell.ConnectSPOService