When writing PowerShell scripts, help yourself and others who read over your script. Name your variables so they make sense. What does that mean exactly? It means that if you are gathering a list of Mailboxes into a variable, name it something like $Mailboxes or $NorthAmericaMailboxes. This way you understand what is being stored in the variable. Otherwise, using a variable name like $N or $C for counting numbers may be confusing.
As you can see, when we use variables that make sense, we can make them better by using singular and plural references in our code. This way the code makes sense and is much easier to follow.
We cover this topic more in-depth in either the Exchange 2016 Second Edition book or in the Exchange Online book offered on this site.
PowerShell Tip #1
Categories: