2
votes

I'm trying to write some scripts for Azure Active Directory / Office online, and I'm completely unable to install the MSOnline powershell module. I've installed the Office Sign In Assistant version 7.2 (64-bit for my 64-bit machine). When I try to run the MSI installer for the PowerShell module, it says it can't find the sign in assistant. When I install the powershell module through PowerShellGet, and then run the commands, it fails with:

Connect-MsolService : The Microsoft Online Services Module is not configured properly. Please uninstall and then reinstall the module. At line:1 char:1 + Connect-MsolService + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [Connect-MsolService], InvalidConfigurationException + FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InvalidConfigurationException,Microsoft.Online.Administration.Automation.ConnectMsolService

Connect-MsolService : Object reference not set to an instance of an object. At line:1 char:1 + Connect-MsolService + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OperationStopped: (:) [Connect-MsolService], NullReferenceException + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Online.Administration.Automation.ConnectMsolService

Is there any way to get this installed ? I've even changed the language of my system to US-English and installed the correct language pack (because I've run into issues before with things not installing correctly if the system language is not US English)

3

3 Answers

1
votes

Found at least a partial answer here that worked (at least got the module working again for one of my accounts, the other one still fails and remains a mystery):

MSOnline can't be imported on PowerShell (Connect-MsolService error)

1
votes

In my case, some registry keys were missing (I don't know why) and reinstalling didn't help. I imported the registry keys with one path adaption from another system and now it works. I used the following registry keys (just copy to a file powershell.reg, change InstallPath if necessary, and import):

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSOnlinePowerShell]
"Version"="1.0.0"
"InstallPath"="c:\\Program Files\\WindowsPowerShell\\Modules\\MSOnline\\1.0\\"
"InstallLanguage"="en-us"

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSOnlinePowerShell\Path]
"WebServiceUrl"="https://provisioningapi.microsoftonline.com/provisioningwebservice.svc"
"FederationProviderIdentifier"="microsoftonline.com"
0
votes

Follow the steps to install the Azure AD Module here