Does anyone else in here use powershell as a sysadmin? If you do, do you also feel the agitation and drive to want to throw yourself down a stair case face first through frustration? I hit a wall...
Does anyone else in here use powershell as a sysadmin? If you do, do you also feel the agitation and drive to want to throw yourself down a stair case face first through frustration?
I hit a wall a couple of weeks ago due to the deprecation of msonline and with this believed it would be good to move to PS7. What I didn't realise is how much of an absolute jar of jam and mustard mix Powershell is. Core, Desktop, modules and clashing assemblies. Trying to combine ps7 core with AD, AzureAD and having to use Graph for license management - urgh!
I just spent two days writing up an amazing script with functions and arrays to load modules, connect to Entra, get licensing info with nice math, turn that in to a menu, create local AD user and sync, license in EntraID, mailbox enable and sync location, the works.
Then, something changed in a module update. Locally in the OneDrive I had 2.6.1 of graph users and Auth, that was playing well with AzureAD in core, but OS had 2.7.0 of graph. I cleared out my modules and it's broken everything, even on reinstallation.
How in the bloody Hell is Powershell ever supposed to be used and stable when module inconsistencies exist everywhere? I pulled down AzureAD again to find it no longer connects in PowerShell 7 core due to assembly version issues. I use the switch to use Windows Powershell for the AzureAD connection to then have that break the licensing math that was working in a function.
Sigh.
I'm coming from Bash on Linux where shit just works. It works for YEARS! Very few times in my almost 30 year career have I had Bash just decide it doesn't want to work and when it does, it's documented. Powershell does not seem to make sense or be documented well.
Anyway. Rant over. Back to working out what module I need fixed at an EXACT version to make it all work again and to hope MS don't randomly deprecate it again.
EDIT and SOLVED!
I shouldn't even need to update this but after spending a lot of time debugging, it turns out that you cannot call microsoft.graph.users and microsoft.graph.users.actions as they will clash, even though they are part of the same package, you'll get assembly issues. The fix - install the whole MICROSOFT.GRAPH module, all 10k parts of it, but DO NOT IMPORT IT. Now you can import-module microsoft.graph.users and the parts from .actions will also be available without loading. I don't understand why, I'm actually past caring. I'm hoping someone else scouring the internet and hitting the same wall may stumble on this and it'll help them out. Hell, I may even blog about it. Thanks for listening to my misery.