Sunday, February 19, 2006

A script to close outlook for PST file backups


Not everyone can afford an Exchange server, but many still want to backup their data, and the most common problem with backing up PST files is that when they are in use, backup programs cannot back them up, and people very frequently leave Outlook open, causing their data to be at risk. So, I searched the Internet for a script, and I found an article from Bill Stewart at Windows IT Pro. I tried the script, but since it was written for Exchange, it force quit Outlook, which for PST users can cause PST file corruption, exactly the opposite of our intent of protecting the data! I emailed Bill, and within a few hours, he gave me a different script to try that would close Outlook more gracefully. It worked perfect. Thanks, Bill! The code is as follows:


On Error Resume Next
Set Outlook = GetObject(, "Outlook.Application")
If Err = 0 Then
Outlook.Quit()
End If

Just copy the above, and paste it into a file named "closeoutlook.vbs" and you can then schedule that file to run a few minutes prior to the backup job. Now, PST files won't be missed on the backups!

Tuesday, January 24, 2006

Path size limitations in Windows


In 10 years of IT employment, I had never seen this before. A client would try to copy his data to the server, and mid copy would get an error, "Unable to remove directory" (which is a really odd error when you are COPYING) and as I researched it, it was indeed due to a path longer than 260 characters.

Meaning if you create subfolders that are 50 characters each, you will only get 5 subfolders deep before it will not let you create any more! I tested this out:

I created the folder structure to mimick the problem, and it cuts off the last folder at 35 characters.

So C:\temp\123456789012345678901234567890123456789012 34567890\12345678901234567890123456789012345678901 234567890\1234567890123456789012345678901234567890 1234567890\123456789012345678901234567890123456789 01234567890\12345678901234567890123456789012345

is 248 characters long, but not 260... Why? Cause it leaves room for an additional 12 characters so an 8.3 name can still fit and be exactly at the 260 char limit.