Sunemaster
Contributor
Contributor

VDR - Domain Controller pre-execs

Hi All,

I've been trying to get my head around a proper way of backing up and restoring virtual Domain Controllers.

I know all the usual warnings from MS and other AD experts, but i think i came up with something useful if only the pre-execs and post-thaws we're doing their job (or at least doing as i expect them to).

Despite a lot of articles out there and also several posts here on the forums, i have not yet seen quite what i'm experiencing.

First of all, i'm doing daily regular System State backups to a different disk inside the VM.

Then i use a pre-exec script in the BackupScripts.d folder under the VMWare Tools program folder.

The script uses the "bcdedit" command to set the "safeboot dsrepair" flag. And i can log that this part actually happens.

The post-thaw script removes the safeboot flag again.

The idea is then that even though it's a snapshot, the AD will never boot in "normal mode" until the system state has been restored manually and the safeboot flag removed (also manually). That way i do not have to explain to people why they have to spam-press F8 during the first start after restore.

However, even though i can see that the scripts has been run and the safeboot flag is set, the resulting snapshot, when restored, just boots normally. It does show that the machine has been shutdown unexpectedly and suggests booting into "regular" safe mode if it gives problems.

Actually, i think that i have experienced both "boot scenarios". Sometimes it does and sometimes it doesn't.

What am i missing in the process?

I'm thinking it could be a timing issue or something, or just plain and simple because that i do not understand the process entirely.

Am i right in thinking that "pre-execs" happen before and are included in the snapshot and therefore restored, while post-thaw happen after and are NOT included in the snapshot and therefore not restored?

Are there any other steps i'm missing?

Hopefully one of you guys can help me out.

Relevant part of the script looks like this:

If %1 == freeze goto doFreeze

If %1 == thaw goto doThaw

if %1 == freezeFail goto doFreezeFail

Goto EOF

:doFreeze

bcdedit /set safeboot dsrepair

Goto EOF

:doThaw

bcdedit /deletevalue safeboot

Goto EOF

:doFreezeFail

bcdedit /deletevalue safeboot

Goto EOF

:EOF

Thanks a lot.

/Sune

0 Kudos
0 Replies