# Retrieve the list of mailboxes from the specified mailbox database$listOfMailboxes = Get-MailboxDatabase "Mailbox Database 1081629644" | Get-Mailbox# Initialize the counter variables that we'll use$mailboxCount = 0$mailboxTotalItemCount = 0$mailboxTotalSize = 0$mailboxAverageSize = 0$mailboxAverageItemCount = 0# Start a loop that will count stats from individual mailboxesforeach ($individualMailbox in $listOfMailboxes) { # increment the mailbox count by 1 $mailboxCount++ # Get the name of the current mailbox so that we can... $individualMailboxName = $individualMailbox.Identity.DistinguishedName #... quickly and easily get stats from that mailbox $individualMailboxStats = Get-MailboxStatistics -Identity $individualMailbox # Get the size of the mailbox in MB and save it in a variable $individualMailboxSize = $individualMailboxStats.TotalItemSize.value.toMB() # Get the number of items in the mailbox and save it in a variable $individualMailboxItemCount = $individualMailboxStats.ItemCount # Add the size of this mailbox to a running total $mailboxTotalSize = $mailboxTotalSize + $individualMailboxSize # Add the number of items in this mailbox to a running total $mailboxTotalItemCount = $mailboxTotalItemCount + $individualMailboxItemCount }# Calculate the average mailbox size$mailboxAverageSize = $mailboxTotalSize / $mailboxCount# Calculate the average number of items per mailbox$mailboxAverageItemCount = $mailboxTotalItemCount / $mailboxCount# Display the results to the userWrite-Host "Total Number of Mailboxes in database: $mailboxCount"Write-Host "Total Size of Mailboxes: $mailboxTotalSize MB"Write-Host "Total Items in Mailboxes: $mailboxTotalItemCount"Write-Host "-------------------"Write-Host "Average Mailbox Size: $mailboxAverageSize MB"Write-Host "Average Items per Mailbox: $mailboxAverageItemCount"

Ever wanted a way to ping an entire subnet and don't have access to a tool to do it? Well this one liner allows that.

The For at the beginning says the variable $i is equal to one, the semicolon separates it from the amount of times the loop is run 1..254 and then the $i++ increments the loop by 1. (You can specify every 5th IP if you want)

The next section runs the windows builtin ping.exe command (make sure you include the .EXE extension) with the switch -n (which means number of times) and then in brackets you are specifying the IP to ping. The where statement at the end is looking for a match of "bytes=32" default output for a successful ping.

I was working with VMware Update Manager and was running a scan on the entire VMguest infrastructure. Well the Update Manager service hung. I am not going to say anything more about that. :)

So I went to the UM server and attempted to restart the service. It sat in stop pending for quite awhile so I decided to kill the process. hmmm how do I do that? I was going to use powershell but the only cmdlet's available are to get- and stop- and restart-. All in the same token as going through the GUI.

Tasklist.exe /SVC
This displays all of the services running and their PID

Taskkill.exe /PID <PID #> /T
This terminates the service and child processes.

This killed the Update Scan on the VIclient and allowed me to restart the service.