We've configured a scheduled script which checks mailbox sizes and alerts us if certain criteria are met, most often mailbox sizes reaching their quota.
While the IT personnel receiving these could start querying the mailbox, or connect to a computer with the relevant Outlook profile configured,
we've found it efficient to generate a detailed folder usage report for the relevant mailbox.
In some cases, the employee can clean up or archive themselves, in other cases the support staff can guide them.
The detailed report can be run on demand, or called to act on mailboxes output from the mailbox size script.
The CSV contains the folder path, folder and sub folder sizes, and the number of mailbox items.
Sample output:
Detailed CSV report:
Parameters:
$UserUPN - the mailbox owner's UserPrincipalName
Report file location, change "C:\Scripts\TEMP\ReportFiles\..." as needed.
$ITAdmin1 - recipient for report. could be the end-user too.
$SMTPServer - your mail relay name/FQDN
$user and $password = username with recipient management rights, and its encrypted password location.
Requirements:
This example is querying an Office 365 Exchange Online mailbox. You could run it on your on-premises Exchange if you invoke a remote connection using Exchange management tools.
Once in a while we need to inventory domain joined servers in a new environment, network segment or when mapping resources before an acquisition or migration.
Whichever the use case, this script will gather basic information from Active Directory, then query the servers themselves using remote PS (Get-WindowsFeature in this case) and WMI (Get-WmiObject) to collect additional info. The output is an html summary, a CSV file which holds detailed information about the queried servers, and an html formatted disk space report.
The report can be run in "AD only" mode - just collect information available about the computer objects using the PowerShell Active Directory module, or in "Full" mode to query additional info from each host ($ReportType parameter.) The freespace part is from an script running around, I think its origins are here.
Sample output:
Disk space report:
Parameters:
$MaxLastLogonDays - use this to focus on "Active" servers, logged on last X days, using the LastLogonDate AD attribute.
$FreeSpaceWarning = 20 and $FreeSpaceCritical = 10 - specify highlighting of low disk space in the html FreeSpca report, accoridng to your needs.
Various report and log files loocation. I use "C:\Scripts\TEMP\ReportFiles...", change as needed.
$ITAdmin1 - recipient for report
$SMTPServer - your mail relay name/FQDN
Requirements:
MS-RPC (135) tcp is open from querying host to servers.
Ports used for WS-Management and PowerShell remoting have been opened: 5985/5986.
Windows Server 2008 R2 for Get-WindowsFeature on remote servers.
Admin rights on remote servers. On stricter environments, these articles may help.
Main improvements I see for this script is remoting and WMI queries error handling. Let me know if you have additional ideas.
You can get it here.