Forum Discussion
Bikash Maharjan
Jul 10, 2020Copper Contributor
PowerShell connection from MacOS not working
I trying PowerShell 7 on MacOS and I have installed SharePoint Online Management Shell but the "Connect-SPOService" command is not found. Get-Module SharePointPnPPowerShell* -ListAvailable | Sel...
WhiteHotaru
Feb 07, 2021Copper Contributor
Bikash Maharjan I just tried it again with Powershell installed via homebrew. I can install the Module Microsoft.Online.SharePoint.PowerShell and after exiting Powershell and running it again I get a full list of commands.
Unfortunately logging in results in an error:
Connect-SPOService: The type initializer for 'Microsoft.Win32.Registry' threw an exception.
Well of course. There is no Win32.Registry on my Mac. Seems like there are still dependencies to Windows machines left.
- Bernd_KroonFeb 08, 2021Brass Contributor
WhiteHotaru and Bikash Maharjan On trying to use PowerShell from MacOSX:
My experience: PowerShell Core works on OSX in the sense that the software runs and that you can use a few modules, like Teams. Butyou simply cannot do anything 'serious' with PowerShell Core on a Mac. Too many modules (while they do install) simply do not work from Mac OSX, for the reason that WhiteHotaru mentioned. Even while many "e-learning books" claim that functionalities work with the PowerShell Core from a Mac (even documented with screenshots): they do not work. I talked to many people, and contacted a famous PnP programmer, they clearly stated that a lot if not most modules will not work from a Mac.
My advise, if you are Mac user with a need/wish to work with Powershell:
- Use Bootcamp on your Mac to set up a lean Window partition; so you will get a truly native Windows installation); switching between OSX and WIN10 required a restart, but that takes a little of your time, like 10 seconds.
- download a Windows 10 installation from Microsoft. You are allowed to use it for a while without activation of the licence; at the end I preferred activating the licence, Windows 10 is worth its money (while I maintain convinced that MacOS is the better OS).
- then install the Windows PowerShell on your Windows account (running natively on your Mac). Install Windows PowerShell 5.1; the version where you see so many blogs and docs advising NOT to use it. But the point is, this Powershell version does everything you expect, it has a nice, very user-friendly interface as well. Use any of your OneDrive accounts to store scripts, so you can also look at them from your OSX environment.
- also install Visual Studio Code as well (you can also do this on your Mac, but ... without the Cmdlets not working, you would do that is you want to use other features, like help with your JSON code).
Succes!!!
- WhiteHotaruFeb 25, 2021Copper Contributor
Bernd_Kroon I tested again and at least the Combination Powershell 7 and the modern PnP.Powershell Module work successfully with the device login option when logging in. SharePoint Online management shell is still broken.