Monday, May 10, 2010

ShadowProtect SBS2003

When you are using ShadowProtect for backing up SBS or regular Windows servers where more than one Domain Controller is present, you will definitely want to consider the following:

To roll back the contents of Active Directory to a previous point in time, restore a valid system state backup. A system state backup can be restored up to the tombstone lifetime number of days after the backup was performed. The backup must have also been made on the same operating system installation as the operating system that you are restoring.

Active Directory does not support other methods to roll back the contents of Active Directory. In particular, Active Directory does not support any method that restores a snapshot of the operating system or the volume the operating system resides on. This kind of method causes an update sequence number (USN) rollback. When a USN rollback occurs, the replication partners of the incorrectly restored domain controller may have inconsistent objects in their Active Directory databases. In this situation, you cannot make these objects consistent.

Microsoft KB888794

If you are backing up Exchange using ShadowProtect:

1. Install latest OS updates (some contain VSS-related fixes)

2. Make sure that the Exchange VSS writer is enabled
By default, SBS does not have this provider enabled.
Microsoft KB838183

a. Click Start, click Run, type regedit, and then click OK.

b. Locate and then double-click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeIS\ParametersSystem

c. Double-click the Disable Exchange Writer value.

d. In the Value data text box, change the value from 1 to 0, and then click OK.

e. Quit Registry Editor.

f. Click Start, point to Administrative Tools, and then click Services.

g. Stop and then restart the Microsoft Exchange Information Store service. Microsoft Windows Server 2003 uses the Volume Shadow Copy service to back up open files. The Volume Shadow Copy service uses a writer component to back up files and settings that are specific to a program, such as Microsoft SQL Server 2000 or Microsoft Exchange Server 2003. The writer component tells the Volume Shadow Copy service which files to back up and then pauses corresponding services while the backup is in progress.

However, you will have to turn off the Exchange VSS writer in order to run NTBackup to capture the systemstate.

prebackup.bat
regedit /s exwriterenable.reg
net stop MSExchangeIS
net start MSExchangeIS

exwriterenable.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeIS\ParametersSystem]
"Disable Exchange Writer"=dword:00000000

postbackup.bat
regedit /s exwriterdisable.reg
net stop MSExchangeIS
net start MSExchangeIS

exwriterdisable.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSExchangeIS\ParametersSystem]
"Disable Exchange Writer"=dword:00000001

This would leave the Exchange VSS writer disabled except when ShadowProtect is running. You could then run NTBackup just before the ShadowProtect job, and save the SystemState using NTBackup.

3. Install the Microsoft hotfix for SQL Server 2000/2005 VSS writer, if required:
Microsoft KB934396

4. Create ShadowProtect backup job and specify “Use VSS for all backups”*
When configuring the backup job, make sure you select “Use VSS” on the Schedule page of the backup wizard. This will avoid getting the Exchange database in a “dirty” state.

5. Backup both the *.edb and log files in a single backup job
These files may be on different directories or volumes – that doesn’t matter.
Backing up all files in a single backup job will ensure that all the data is consistent.



Thursday, April 29, 2010

Problems with HTA using VBScript and Office 2010

I am testing Office 2010 Beta - take a look at my post "VBA Problems in Outlook 2010 part 1" to see all about my network.

(editor's note: as a Microsoft Partner, my official RTM copy of Office 2010 was made available to me on May 5, 2010. I downloaded it, installed it, and can confirm that this same problem persists in the final version.)

I use Outlook Contacts to write letters using my letterhead(s). I am able to select from a list of letterheads - I may want my company letterhead, or my personal return address, or from several other choices. I highlight a contact, then click on an icon in the toolbar that is linked to a particular macro that calls an .hta file, that in turn pops up a radio button list of Word templates to use as the starting point for the letter.

This .hta in turn starts Word using the selected template, and the template gets the contact name, address, etc. from the Outlook contact.

The problem is that the following code will not run in 2010
set objNewDoc = objWord.Documents.Add(template2open,false)
unless a msgbox or popup is run just before you call objWord.Documents.Add

Sub OpenDoc()
Set objWord = CreateObject("Word.Application")
'required in 2010 to show a message box before calling the documents.add
'could use objWord.Version
if Left(objWord.Build,4) = "14.0" Then
intButton=WshShell.Popup("A letter will start using " & template2open,1)
End If
set objNewDoc = objWord.Documents.Add(template2open,false)
objWord.Visible = true
objWord.Activate
ExitHTA
End Sub


I'm not sure why this is happening, but the above code solves the problem. I found it quite by accident, because I was using a msgbox template2open statement just to make sure that the variable template2open actually had a value. It did, and when that line preceded the objWord.Documents.Add(template2open,false), then it started working. I also noticed that on at least one occassion, before I had found the problem, the old code worked, so this may be a spurious error.

I sent a frown to Microsoft concerning this problem, but I am not sure if they understand the problem, nor if they can fix it because the RTM version has apparently been released prior to my discovery of this problem.

VBA Problems in Outlook 2010 part 1

I was testing out the new MS Office 2010 Beta, and trying to update some VBA routines that I had written. These routines work just fine in Outlook 2003 and 2007, but did not work "right out of the box" for 2010.

I needed somewhere to post the problems that I ran into, and solutions for them, but could not find anything by googling "VBA Outlook 2010 problems", so I created this blog. I hope these blogs help other people.

By the way, I did send a frown to Microsoft outlining each of these problems, but they limit you to the number of characters you can send, I don't know if they understood and can fix the problems, and it looks like they have already produced the RTM version of Office 2010 by the time I discovered these problems.

One note of caution: when I first experimented with my vba macros in 2010, at some point after playing around with the code, the macros would not run at all. Outlook would not allow me to enable macros - it would display "An error occurred while attempting to verify the VBA project's signature. Macros will be disabled"

After trying everything included creating another cert by using self-cert, I gave up and went to another computer running 2003. But the macro (my VBAProject.OTM file is in my Redirected Folders, and so the same file is used no matter where I am logged in on the network. This will probably be true of most users.)

The file would no longer run in Outlook 2003, and I could no longer edit the file in 2003. Since there was no way to edit it in 2003, and I could not run it to test it in 2010, then this file became useless.

BACKUP YOUR FILE BEFORE YOU START USING Outlook 2010!!!

This happened to me twice, and I don't know the reason. It could be because of errors in the code, or there may be an incompatibility between Outlook versions. But heed my warning.

The solution to this, at least apparently, was to password protect the file!. After I did that, all of the security issues and file corruption disappeared.

On the Developer tab, click Visual Basic> Tools> Project1 Properties> Protection (tab)>Lock project for viewing (checkbox)> enter the password

By the way, it took me a while to figure out how to edit a VBA project in 2010. You first have to enable the Developer tab on the toolbar by
1. Press the Office logo button next to the Home tab and choose Options.
2. Select the section Customize Ribbon.
3. In the right pane, enable the selection field before "Developer".
4. Press OK to close the open dialog.

The first bit of code that gave me problems had to do with trying to get to a Public Folder.
(sorry for the line breaks - I will see if I can fix that in later edits. This is my first post)

Set objFolder = GetFolder("Public Folders\All Public Folders\" & ProjectListBox.Value)
If objFolder Is Nothing Then MsgBox "Folder does not exist"


The ProjectListBox.Value is simply a value taken from a listbox, and it is a list of Public Folders. In 2010, this piece of code always returned nothing, and the Msgbox would pop up.

It turned out that MS has changed the name of the Public Folders in 2010 (at least when running 2010 under Windows 7 when connected to a Windows Server 2008 (with Exchange 2007) domain - it is Small Business Server 2008.

The public folder now is called Public Folders - user email address\All Public Folders\Foldername
So I created a variable called usermail, and can get the current user's email address.

usermail = Application.Session.CurrentUser.AddressEntry.GetExchangeUser.PrimarySmtpAddress
Set objFolder = GetFolder("Public Folders - " & usermail & "\All Public Folders\" & ProjectListBox.Value)
If objFolder Is Nothing Then MsgBox "Folder does not exist"


Of course, you only want this piece of code working in 2010, not in 2003 or 2007, so that involves another piece of code to get the application version:

If Left(Application.Version, 4) = "14.0" Then
blah blah blah

So the original code gets wrapped in an IF STATEMENT
If Left(Application.Version, 4) = "11.0" or Left(Application.Version, 4) = "12.0" Then

That's all for now, but there may be a VBA Problems in Outlook part 2 at a later time.