Check free space on volume mount points

Wow! It’s been a while since I have posted any scripts! This is mainly due to the fact that I am rather busy at work, and also working hard at completing my MCITP.

A while back a client of mine, asked if there was an easy way to use one computer to check the free space of mount points. This was a real problem for them, as the administrators would come in every morning and manually logon to each server, and use disk management to check the free space.

I was certain that there had to be a WMI object for mount points, so after a little digging, I came up with the following script:

$TotalGB = @{Name="Capacity(GB)";expression={[math]::round(($_.Capacity/ 1073741824),2)}}
$FreeGB = @{Name="FreeSpace(GB)";expression={[math]::round(($_.FreeSpace / 1073741824),2)}}
$FreePerc = @{Name="Free(%)";expression={[math]::round(((($_.FreeSpace / 1073741824)/($_.Capacity / 1073741824)) * 100),0)}}
function get-mountpoints {
$volumes = Get-WmiObject -computer $server win32_volume | Where-object {$_.DriveLetter -eq $null}
$volumes | Select SystemName, Label, $TotalGB, $FreeGB, $FreePerc | Format-Table -AutoSize
$servers = (Get-Content .servers.txt)
foreach ($server in $servers){

The script is written to collect server names from a text file, but you could use any other method to supply you server names.

Hope this helps someone else!

Find and delete duplicate Outlook Contacts

I have been fairly busy at work with little or no time to write. I did however manage to write a neat script on Friday which I thought I had to share.

My Nokia decided last week that it felt the need to duplicate all my Outlook contacts after I changed something on the ActiveSync profile. Now, normally this is not a big deal, as you can simply sort the contact items by creation date, and delete the duplicates, that is unless you mess around with them, and recreate them all from scratch. (insert curse word here)

I took one look at this problem and thought that it would be far too easy to just delete them manually. I decided to write a script to do the work for me. I have been playing a lot with the Outlook COM object lately so I already had most of the code to get this done quickly.

The script will collect all your contacts, and do a unique sort on the FullName. It then creates a temp folder under your default contacts folder, and moves the unique contacts (remember sorted by FullName only), to the temp folder.

It then dumps all the duplicates in the default contacts to a CSV and deletes them from the contacts.

At this point I stopped the script, as it made sense to check the CSV and the temp folder, and move your contacts back manually if you are happy with the results.

As usual, be very careful with this one. Automatic deletes always have the potential to end in tears. Make a backup of all your contacts before you start with the script.

I hope this script can help you.

You can download the script from here:

Updated: Exchange 2007 audit script (Version 2)

I have finally been able to complete the updates to my Exchange 2007 audit script. The script has some enhancements which includes suggestions and comments from some readers.

The new script includes a few checks against CAS servers, which I feel have been neglected in the past. These checks include test-owaconnectivity and test-activesyncconnectivity. These two commands need some additional work to enable. To test if these command will work, you can run both test-owaconnectivity and test-activesyncconnectivity with the –ClientAccessServer switch. Additional information will be available in the console if the commands are unable to run.

I have been meaning to update the HTML format, as designed and used by Virtu-Al, but I have been unable to find the time. This is definitely high on the priority list, as the new format is supported by multiple browsers, and cuts down the number of lines of code significantly. I really wanted to include the new HTML in this release, but it would have delayed the release by weeks.

Here is a complete list of changes:

 – You have the option to specify a list of servers to audit, if you don’t, the script will use get-exchangeserver to find servers to audit.
 – Changed disk space to values to gigabyte.
 – Added white space to mailbox store report. ( This is done with dotnet, and has been optimised to be really quick)
 – Added MAPI connectivity test to mailbox server report.
 – Added OWA connectivity report for CAS servers.
 – Added ActiveSync connectivity report for CAS servers.
 – Cleaned up some variable names.

I will release a newer version soon, which will include a few additional checks, and will also use the latest HTML code.

Your comments and suggestions are always welcome.

The script can be downloaded from here:

This script has been replaced by a later version, please check the following link, or download the updated version below: