When you want create large PowerShell script, you need to create one or more functions. This can help you reduce number of rows and orientation in code. If you want execute the same part of the code with different values in variables, this is best for you.
For most Administrators is better to use Powershell for manage Exchange Server. On classic On-premise installation of Exchange Server, Administrator can use Exchange Management Shell or PowerShell with Exchange module for manage the server. But when you have Office 365, then you do not have Exchange Management Shell (this is part of Exchange Server installation). You can use PowerShell on your machine and connect to Office 365.
The important thing what you should to know when you plan to use Microsoft Test Manager is that you need TFS (Team Foundation Server). For your experiments you can use online TFS. (http://www.visualstudio.com/products/visual-studio-online-overview-vs)