I had this issue and couldn´t find any answer. The issue was that I was trying to use Azure cdmlets to connect to O365 via c# code, but I couldn´t get the connect-msolservice
.
""The term is not recognized" error when you try to run administrative Windows PowerShell cmdlets in Office 365"
After reviewing Microsoft's TechNet article "Azure Active Directory Cmdlets" -> section "Install the Azure AD Module", it seems that this process has been drastically simplified, thankfully.
As of 2016/06/30, in order to successfully execute the PowerShell commands Import-Module MSOnline
and Connect-MsolService
, you will need to install the following applications (64-bit only):
- Applicable Operating Systems: Windows 7 to 10
Name: "Microsoft Online Services Sign-in Assistant for IT Professionals RTW"
Version: 7.250.4556.0
(latest)
Installer URL: https://www.microsoft.com/en-us/download/details.aspx?id=41950
Installer file name: msoidcli_64.msi
- Applicable Operating Systems: Windows 7 to 10
Name: "Windows Azure Active Directory Module for Windows PowerShell"
Version: Unknown but the latest installer file's SHA-256 hash is D077CF49077EE133523C1D3AE9A4BF437D220B16D651005BBC12F7BDAD1BF313
Installer URL: https://technet.microsoft.com/en-us/library/dn975125.aspx
Installer file name: AdministrationConfig-en.msi
- Applicable Operating Systems: Windows 7 only
Name: "Windows PowerShell 3.0"
Version: 3.0
(later versions will probably work too)
Installer URL: https://www.microsoft.com/en-us/download/details.aspx?id=34595
Installer file name: Windows6.1-KB2506143-x64.msu
After hours of searching and trying I found out that on a x64 server the MSOnline modules must be installed for x64, and some programs that need to run them are using the x86 PS version, so they will never find it.
[SOLUTION]
What I did to solve the issue was:
Copy the folders called MSOnline
and MSOnline Extended
from the source
C:\Windows\System32\WindowsPowerShell\v1.0\Modules\
to the folder
C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules\
And then in PS run the Import-Module MSOnline
, and it will automatically get the module :D
The solution with copying 32-bit libs over to 64-bit did not work for me. What worked was unchecking Target Platform Prefer 32-bit check mark in project properties.
I'm using a newer version of the SPO Management Shell. For me to get the error to go away, I changed my Import-Module statement to use:
Import-Module Microsoft.Online.SharePoint.PowerShell -DisableNameChecking;
I also use the newer command:
Connect-SPOService
Connects to both Office 365 and Exchange Online in one easy to use script.
REMINDER: You must have the following installed in order to manage Office 365 via PowerShell.
Microsoft Online Services Sign-in Assistant:
http://go.microsoft.com/fwlink/?LinkId=286152
Azure AD Module for Windows PowerShell
32 bit - http://go.microsoft.com/fwlink/p/?linkid=236298
64 bit - http://go.microsoft.com/fwlink/p/?linkid=236297
MORE INFORMATION FOUND HERE:
http://technet.microsoft.com/en-us/library/hh974317.aspx
The following is needed:
- MS Online Services Assistant needs to be downloaded and installed.
- MS Online Module for PowerShell needs to be downloaded and installed
- Connect to Microsoft Online in PowerShell
Source: http://www.msdigest.net/2012/03/how-to-connect-to-office-365-with-powershell/
Then
Follow this one if you're running a 64bits computer:
I’m running a x64 OS currently (Win8 Pro).
Copy the folder MSOnline from (1) –> (2) as seen here
1) C:\Windows\System32\WindowsPowerShell\v1.0\Modules(MSOnline)
2) C:\Windows\SysWOW64\WindowsPowerShell\v1.0\Modules(MSOnline)
Source: http://blog.clauskonrad.net/2013/06/powershell-and-c-cant-load-msonline.html
Hope this is better and can save some people's time