All posts by JosL

Script too Complicated

Sometimes, an error can really make you:

futurama-fry-should-i-lol-or-roflmao

Look at this one:

At line:1 char:1
+ & { Set-StrictMode -Version 1; $this.Exception.InnerException.PSMessa …
+ ~
Processing was stopped because the script is too complex.
+ CategoryInfo : ParserError: (:) [cleanFolder], ParseException
+ FullyQualifiedErrorId : ScriptTooComplicated,cleanFolder

When Powershell tells you your script is too complex, you know you’re coding an awesome script but that you’ve either made a mistake or are running into some builtin limit. Finding documentation about this error is hard, but a reply on a forum somewhere pointed me to recursive functions.

Yes, I was using a recursive function in this script. The script itself was started by the Start-Job function in a ‘main’ parent script. If I ran the child script seperately on its own, it had no issues and ran fine.

Start-Job apparently gets you into trouble when you’re using recursive functions and the recursion level becomes too deep. I ended up using Runspaces instead to avoid this issue altogether, and noticed the resulting script was faster and more stable as well.

Lesson: runspaces are superior to Start-Job.

Onedrivemapper v2.23 released!

Version 2.23 of OneDriveMapper has been released.

  • an additional parameter was added by request which will stop the script if no ADFS server was found
  • two minor bugfixes
  • improved detection of driveletter presence, OM will actually remap the drive if it is mapped to another location than your O4B instead of detecting it as ‘active’.

Get the new version here

Verifying the ServiceStatus of a specific sublicense in Office 365

If you assign licenses in Office 365, you’re essentially assigning license bundles. Each license usually consists of several sublicenses, like this:

In a case I ran into for a customer, the ‘Exchange Online’ component was sometimes not enabled for certain users. It took us  a while to notice that the serviceplan of the main license had been unchecked. In Powershell, it would normally look like this:

O365_servicestatusPS_screenshot

Of course now we’d like to know which of our thousands of users did not have a EXCHANGE _S_STANDARD ServicePlan with a ProvisioningStatus of “Success”  after the migration to Office 365.

So, I wrote the following Powershell snippet Continue reading Verifying the ServiceStatus of a specific sublicense in Office 365