If you’re working with Office 365 than you may want to check out the Office 365 Helper Scripts package. This package includes a number of helper scripts created during Office 365 deployments.
The scripts require PowerShell 2.0 and the Microsoft Online PowerShell modules. Windows PowerShell 2.0 can be downloaded from the Script Center Downloads page. The Office 365 modules can be downloaded from Office 365 Cmdlets. In addition, the user executing these scripts must have administrator-level Office 365 credentials.