Exporting the Exchange Global Address List

I remember when we switched a client of ours from Lotus Notes to hosted Exchange. One of the big complaints they had was not having a way to print the company directory like they could in Lotus Notes. At the time, which was probably almost 7 years ago now, I could not find an easy way to do this. The only way I could find was to add every contact to your personal contacts. Then from there, you could export them out to Excel. This was a real pain in the arse. First, you didn’t want to mix them in with your contacts, so you’d have to create a separate folder. You’d have to add them, and then you’d have to delete them when you are done, so next time you didn’t have employees in the list that have left the company.

Because this client used Lotus Notes for some databases and was unable to migrate them to other systems they attempted, they kept Lotus Notes anyway. They decided just to keep the phone directory current, so employees can print out the phone list. Problem postponed.

As the company has grown, they needed the ability to send the global address list to their Shanghai facility, which has it’s own email system. Also, we’ve had other customers make the same complaint about not being able to print out the address list. So again, years later, I’m searching for a way to export the Global Address List.

This time, I found a solution that was a little better than adding every contact to your personal contacts. The new way was to use Access. First, you open a blank database. Then you click on the Get External data buttons and chose Outlook. You are then able to import the Global Address List into Access. Once in Access, you can then Export to Excel, at which point, I then had to clean up the spreadsheet.

After doing this a few times and having recently taught myself python programming, I decided to write my own application to do this in one easy step. I was tired of wasting 30 minutes every time I needed this list, which was at least once a month.

I wrote an application that allows you to pick the fields you want exported, choose the Excel file to save to, and simply click Export. Outlook opens if it’s not already. Depending on your settings, it may ask if you allow the program to run. A few seconds later, it’s done (depending on how many contacts are in your directory).

I decided to throw it up on it’s own website for those who have the same problem. You can download it there.

Global Address List Exporter

Down and dirty way to determine average latency using Python, text files, and a batch file | Playing with Python

Here’s a post I put out on my python blog. I figured it would be helpful for sysadmins and the like, so I figured I’d post it here as well.

A client of mine is looking to give access to their ERP application to their office and plant in Shanghai. They are going to do this via Citrix, so I wanted to see what latency was like. To do this, I just setup a batch file that runs pings to both locations and outputs the results to a text file. I scheduled this to run every 4 hours. Here’s the batch file.

@echo off
set officefile="C:TempShanghaiPingsping_office_%date:~4,2%-%date:~7,2%-%date:~10,4%_%time:~0,2%-%time:~3,2%.txt"
set plantfile="C:TempShanghaiPingsping_plant_%date:~4,2%-%date:~7,2%-%date:~10,4%_%time:~0,2%-%time:~3,2%.txt"
ping -n 10 192.168.70.254 > %officefile%
ping -n 10 192.168.71.254 > %plantfile%

After running for about a week, I wrote a small python script to grab all the ping times out of the text files and give me the maximum, minimum, and average response times. You are prompted for the location of the text files and the beginning pattern, so you can get the results for each site.

import os
import re

pingfiles = []
filepath = input('Please enter where files are stored:(Ex: C:files)  :   ')
filepath = filepath + ''
beginning = input('Please enter what each file starts with: (Ex: ping_plant)  :  ')
for root, dirs, files in os.walk(filepath):
	for file in files:
		if file.startswith(beginning):
			pingfiles.append(file)

pingtimes = []

for file in pingfiles:
    filename = filepath + file
    openfile = open(filename, 'r')
    lines = openfile.readlines()
    responsetimes = re.findall(r'bytes=32 time=(d+)ms', str(lines))
    pingtimes = pingtimes + responsetimes
    openfile.close()

pingtimes = [int(i) for i in pingtimes]
print("Maximum ping time is", max(pingtimes))
print("Minimum ping time is", min(pingtimes))
print("Average ping time is", round(sum(pingtimes) / len(pingtimes)),)

Here’s the output for one location:

Maximum ping time is 307
Minimum ping time is 237
Average ping time is 254

I know this is nothing special, but I figured I’d throw it out there in case any other newbies or sys admins need to get this information quickly without software.

via Down and dirty way to determine average latency using Python, text files, and a batch file | Playing with Python.

Windows updates are not enough…

So, you are feeling good about your systems because you have patch management setup or on your personal PC, you have automatic updates enabled. While that’s great since everyone knows you have to keep Windows patched or run the risk of vulnerabilities on your computer being exposed, it simply is no where near enough.

One of the biggest vulnerabilities now is Java. Unfortunately, Java needs updated so often and is so annoying about the way it updates, people pretty much shut it off. Add to that, the Java update loves to sneak crapware like the Ask.com toolbar into the update, and it’s no wonder the majority of Java run time environments aren’t current. The same could be said of Adobe Flash, Quicktime, Adobe Reader, etc.

Luckily, there is a simple way to manage all these updates by using a little program called Ninite. There is a free version for home users and there is a pro-version for businesses that need to set this up centrally.

For home users, you simply click all the apps you want to stay updated on the Ninite webpage and click download for the executable that you will run. If one of the programs you check isn’t already installed, the Ninite program will install it. Simply run this program on a regular basis to keep all the applications up to date. If you are savvy enough, you can schedule this with Windows Scheduled Tasks. Please make sure the Java update is one of the updates you choose.

For those of us who need to set this up centrally, there is the Pro version. With the Pro version, you can launch the application silently. You can simply create scripts to call the program silently with the applications you want to update and or install. You can specify update only if it’s installed or you can specify to install if not already there and update if it is. You can also output to a log. If you can do some programming, you can then parse that log file for any failures and alert yourself. You can also parse it for successes if you need to capture the data for reporting the status of updates across all your machines.

If you aren’t great at scripting, you can also launch the GUI and pick the machines to update and push the updates out. Who wants to do this manually though when you can automate it.

Lastly, from what I gather they have a Linux beta. I haven’t tested it, but from what I can see it’s for Ubuntu only right now. Updates on Linux are already very simple and can be automated, so I’m not sure what it brings to the table. I’ll have to check it out when I get some time. I’m running Linux Mint currently and updating is a cinch.