I ran into an interesting problem that required removing the Windows OS license from workstations. The workstations were already removed the existing domain so I couldn’t use my normal tools. Fortunately, I still had other methods to launch a remote PowerShell script. I specially wrote my piece of of the overall script as a function. This way it could be easily dropped in, or edited, without much trouble. It is a simple script, but shows the type of flexibility you can exercise with PowerShell.
First, I’ll note that there are optimizations, and other methods, to accomplish this same task. I wanted to put out something that was easily understood and implemented. Purpose: This is a PowerShell script logs into Office 365, queries for disabled and unlicensed accounts, and removes those accounts from a specific Exchange online distribution group. It … Read morePowerShell: Reconcile Exchange Online Distribution List