Last month, in “Make PowerShell Clever with Decision-Making,” I showed you how to use If/Else statements to give PowerShell the necessary decision-making capability to effect some otherwise tedious Active Directory (AD) housekeeping. But that decision-making was sort of simple. It chose from two mutually exclusive and collectively exhaustive situations: Do you have a middle initial, or do you not? This month, I’ll show you a more complex bit of housekeeping that you’ll accomplish by creating another, more complex script, and in the process you’ll meet the switch statement. You’ll also meet a PowerShell cmdlet called move-adobject that lets you move user accounts around inside a domain.
↧