Windows Server 2008: Creating and Maintaining System State Backups on Your Domain Controller
May 27, 2008
I was very excited when I started to play around with the first beta versions of Windows Server 2008 and experiment with the latest security improvements. At first, I wanted to start with one of the more basics and important things on this new server: Active Directory.
Several improvements were made on security matters that we can find it related to Active Directory: Read-Only DCs, more group policies, auditing enhancements, etc. After installing a small lab to check all these features, I finally arrive to another important Active Directory matter: Backing up and Restoring Data from a Domain Controller.
I was pretty disappointed at first when I realized that there was no easy way to backup a system state from a Domain Controller. Even more disappointed when I couldn’t find out the way to schedule a system state backup! Well on this post I want to review the way to simply schedule a system state backup on a Domain Controller and maintain those backups by removing the old ones from the backup catalog.
Requirements
a. A secondary hard drive on the domain controller. It cannot be a network drive.
The only storage point possible for backing up your server is using a secondary hard drive that can only be attached locally.
b. Having the Windows Server Backup feature installed.
The first thing that you must know to start backing up data from Windows Server 2008 is that the backup tool is not installed by default, like it was on Windows Server 2003 with ntbackup. To install it:
a. Open Windows Server Manager snap-in
b. Access Features section and click on Add a New Feature
c. Select Windows Server Backup including the sub-item “Command Line Tools”
i. This will also need Powershell
d. Click on Install.
Scheduling System State Backup
If you check the GUI of the Windows Server Backup you’ll see that there’s no way to backup the system state from there:
The only way to backup the system state using this tool is using the command line. So, to use this backup feature as a scheduled task, we are going to create a .bat file and schedule this batch file to run on our desired time (actually you can skip creating the .bat file, and just use task scheduler with the right parameters).
1. Open notepad and insert:
@echo off
WBADMIN START SYSTEMSTATEBACKUP –backuptarget:e: -quiet
“e:” is your local hard drive where the backup catalog will be stored.
“-quiet”: is the parameter used to not ask for confirmation
2. Save it as a batch file. Like: systemstatebackup.bat
3. Open Task Scheduler and create a “New Task”. The task properties window will open.
4. On the “General” tab select:
a. “Run whether the user is logged or not”
b. “Run with the highest privileges”
5. On the “Triggers” tab, click on “New”:
Here is where you select how often the backup task will run. This is an example of a task running weekly:
6. On “Actions” click on “New” and select to “Start a Program” and browse the batch file you just created.
7. Click on “OK” and the schedule task is ready.
You can manually run this task on demand by right-clicking it and selecting “Run”.
This task to complete takes between 40 minutes to 1 hour (or even more), depending on the system state data (Active Directory, DNS, registry, certificates, etc).
This is the process running
I have the backup… but what a hell is this??
Probably your first impression on the backup won’t be the best:
You don’t have permissions to see the backup files at first
You don’t see a simple .bkf file as it was when you used ntbackup
The size of every backup (that means every time you run the task) is as much as the size of the system drive
After all that, maintaining those backups sounds a little bit hard to do, the backup hard drive will significantly increase in a few weeks and for sure, you won’t be feeling much comfortable if you just try to delete.
Keeping It Simple… and smaller
But not of these annoying things are here to just making our work a little bit hard and awkward. Besides from adding a new layer of security to our backups, it also the maintenance of the old backups will actually get simpler.
You can create a new scheduled task that will keep every week (if that’s your case) only the newer backups on your catalog:
WBADMIN DELETE SYSTEMSTATEBACKUP –backuptarget:e: -deleteOldest –quiet
This way you will prevent from the backup hard drive to easily increase enormously. A good thing to keep in mind if you are working with virtual machines, you’ll probably know that it’s REALLY annoying having a big size virtual disk, and not being able to decrease their size (not an easy way anyhow).
This is the cmd running and deleting an old backup from system state (without the -quiet parameter).
To restore an Active Directory using these backups is not very much different from backing it up, we can see that procedure on a next post.
Hope it helps!
Cheers!
Troubleshooting DCDIAG error: RPC Server is unavailable
April 7, 2007
It’s a common best practice to run the DCDIAG tool in all DC in your forest whenever a significant change has been made, i.e. a new DC has been added or deleted in the forest. With this you are testing if the change you just made was done correctly.
It’s also common that if you have at least two domains in your forest (and the trust relationships in place), when you run dcdiag in any DC you get a message indicating that when the test of replication on a specific server applies, it fails indicating that the “RPC Server is unavailable”.
Well, if you see this message you probably check if that the RPC service is up and running on the server… running in cmd “net start rpcss”. But the command prompt answers you, “don’t worry dude, the service was already running”.

“Alright then…” you say, “Let’s try DCDIAG again”… and you get the same error like the first time…
And then you go like “Hmmmm… why do I keep getting the same “RPC Server is unavailable” error?”
And then I say “I know why dude!”… And then you “You do? Is there any way I can solve it?”…
“Of course, why I’ll be posting something that I don’t know the answer!”… and then…
OK, enough with the theatre…
This issue appears when the configurations between the different DNS servers are not compatible. It’s something like this: you have a correct configuration in a DNS server that forwards any requests that does not belong to his domain ; but in the second domain, the DNS server does not forward the requests that ask for the first domain… was it clear? Let’s do a picture then!

In this graphic, a contoso domain member it’s trying to get something from fabrikam, the DNS Server from contoso receive the request and see that it belongs to fabrikam and forwards the request to the correct DNS Server. But in the other side, a fabrikam user wants to get something from contoso but when it gets the requests, see that it’s not for fabrikam and it does not have anything that says that the request must be forward it to another DNS Server, so can’t solve the user’s request.
After naming “forward” several times you probably know where the problem is: The forwarders on your DNS servers are not set correctly. The most like problem is that having different domains in the same forest, the DNS servers from each domain don’t know were to direct the requests for all the other domains.
Let’s take one server to solve this problem: Access the DNS snap-in of your DNS Server, on “Properties” select the “Forwarders” option and select “New” in DNS Domain and add all the domains in your forest; and put the IP address to the DNS server holding that domain.

In this case, LEONARDO is DNS Server for CORPNET and I’m adding in the Forwarders configuration that any request for EXTRANET, my second domain in the forest, are been forwarded to its DNS Server. In EXTRANET the same configuration must be set, of course
Also there’s another way to solve this problem. You can add an EXTRANET zone in CORPNET Forward Lookup Zones that holds all of the DNS records for this domain. In this case you must also set, in EXTRANET DNS, the properties for this zone, to “Allow Zone Transfers”, letting another DNS server, CORPNET, to also have the records for this zone. But, in my opinion, is also a good idea to not over charge your DNS server with all kind of request, so if it’s not for his domain, forward to the correct DNS server for resolution.
If the error keeps appearing, then you should check the trust relationships between domains. And any other error message that DCDIAG shows in all DCs.
Cheers!
Creating a failover environment for your domain
April 7, 2007
Scenario:
I have the domain contoso.com with only one DC (with DNS) and I wish to add another one in case something goes wrong.
- The first thing that you must have is, of course, the new server where you are going to install your second DC. It’s highly recommended that both servers are working with the latest updates, Windows Server 2003 R2 SP2. And the domain is raised into “Windows 2003” functional level (on this level there are some improvements in many things, including the replications between 2003 servers).
- Run the Administration Tool “Manage Your Server” in the new Windows 2003 and add the role “Active Directory” for this server.
Domain controller promotion wizard
- Configure the server as a DC for an existing domain and follow the instructions in the wizard. You’ll be asked for the credentials of privileged account to add a new server. The account must be a member of the “Domain Admins” group.
- After the promotion of the new DC is completed, visit again “Manage your Server” and add the role “DNS Server”, but don’t set any new zone on this server. When you configure it as a DNS server the primary server will replicate the zones with this new server.
- Each DC must be pointing to themselves as the first preferred DNS server and the secondary DNS must be the remaining DC.

First DC TCP/IP configuration
Second DC TCP/IP configuration
- At this time the DNS records must be replicated and in both servers you should have the same zones and records. Check the DNS snap-in for the new DC and check that the zones are identical in both DCs.
- IMPORTANT: Any special configuration of the first DNS server, i.e. “Forwarders” configurations or in “Zone Transfers”, are NOT replicated between servers, for obvious reasons. So if you are trying to make this new DC to act as a replacement when the first DC is down (that’s a failover environment), you have to set the same configurations manually.
- Global Catalog: You also have to add the role “Global Catalog” in the new server, to do this visit “Active Directory Sites and Services”, expand the site where the DC is located, since we are using all the DC in the same subnet, all of them must be in the same site (the DC is automatically located in this site when you assign him the IP address). Expand “Servers” and expand in the new server name, right click on “NTDS Settings” and click “Properties”, select the option “Global Catalog”.
Global Catalog option on NTDS Settings
Remember that in the forest must be at least one GC up and working at all moment.
Control and Tests
To check that the functionality for the new server and the replication is working properly you can do these tests:
· On the new DC, run cmd and type “ipconfig /registerdns” to ensure the creation of a record for name resolution.
· Install Windows Support Tools and run the DCDIAG tool as it follows: “dcdiag /test:registerindns /dnsdomain:contoso.com /v”. Basically what you are doing here is letting know that this is a valid DC for the domain.
· Open the “Active Directory and Computers” snap-in, on the “Domain Controllers” built-in ensure that both of the existing DCs are located there.
Domain Controllers in CORPNET.AD
· Open “Sites and Services” snap-in and check that all the servers within the forest are listed. Expand every each of them and in “NTDS Settings” (this section indicates with which servers will replicate each DC) the list in the right in every DC should be listing the remaining DCs. If anyone is missing you have to add it manually selecting “New Active Directory Connection”.
Replication
In this snap-in you can check the manual replication between servers. Right click in the listed servers in NTDS Settings and select the option “Replicate Now” you should get the message “Active Directory has replicated the connections”.
· Run “dcdiag” in command prompt and check that the entire test is passed successfully.
· Check the Event Viewer in all DCs and watch for any error description. If something out of the ordinary appears, you can check http://www.eventid.net and insert the Event ID number from the error that you found. The site will display you pretty much the same information that you have in the event description, but you also will find user comments about this error and how they solved it.
- After these tests are completely successfully, change the DHCP server (if you have it) configuration to start using both DNS servers. In the DHCP snap-in, expand the Scope and Scope Options. In the right you will find the entire configuration that is distributed with a common lease. Double-click in “DNS Servers” and add the IP of the new DC.
DHCP Configuration
You are all set now…
Cheers!!
Troubleshooting a special case for DC and DNS servers
February 27, 2007
“My DC is online, the TCP/IP it´s OK, the DNS service running but I still cannot make a valid connection with AD! “
This is a problem that can be present in many ways. The most common example is: you have your DC completely configure for Active Directory, the DNS server too, and you try to join a workstation to your domain and the following error appears:
An Active Directory Domain Controller for the domain [yourdomain.com] could not be contacted.
Ensure that the domain name is typed correctly
(…)

First of all, the obvious: Check that the connectivity is working fine… the DNS server and the DC both of them responds to PING requests. It’s most likely that if you cannot connect to the domain, the PING requests for the FQDN (such as: ping dcname.yourdomain.com or ping yourdomain.com) will not respond as well… but with the IP parameter should be working… if it’s not, then there’s definitely a connectivity problem, a bad TCP/IP configuration or a firewall within the way .
Well, let’s see, this is a problem that can really make you nuts trying to solve it.
Let’s assume that you have the correct configuration in your DC and workstations. If you have a DHCP server in you network, check that he is doing his job… giving the correct IP address for the workstations, the subnet mask, the DNS server and the other parameters that you are using.
DCDIAG really? Can that help me?
One of the possible reasons of your problem is that DC didn’t register himself in the DNS for let the AD know that he is a valid domain controller. To do that, use the DCDIAG tool (included in the Windows 2003 Support Tools) as it follows:
dcdiag /test:registerindns /dnsdomain:yourdomain.com /v

Where yourdomain.com is the complete FQDN of your domain
If everything goes ok, you will get a message like this:

Using NSLOOKUP
NSLOOKUP is a very helpful utility to test the name resolution in a DNS server. You’ll use this tool to check the SRV (service) records are in place for the correct functionality of Active Directory.
Type in the command line nslookup and press enter. You will probably find a message like this:
“*** Can’t find name server for the address : Non-existent domain”, don’t worry about it. This happens when you don’t have set any PTR (or reverse records) in your DNS server, to resolve IP address in names.
Carry on then, at nslookup (”>”) prompt type:
set q=srv press enter.
Then type: _ldap._tcp.dc._msdcs.yourdomain.com
Again, sometimes because you don’t have any PTR records you may find some “time out” messages, but there is nothing vital at this point.
If there is no problem with that, you will see the DNS server name and its IP address… if you don’t, you still have one thing to do.
That thing you never wanted to do… modifying a .dns file
The file that probably will save you is saved in: C:\WINDOWS\system32\config and with the name netlogon.dns.

You have to open this file with the notepad and take a look to it, but don’t get frightened! … You will see a bunch of lines that will probably don’t have much sense to you, but one of them we are looking for:
_ldap._tcp.yourdomain.com IN SRV 0 0 389 ldap_server_name
_ldap._tcp.dc._msdcs.yourdomain.com IN SRV 0 0 389 domain_controller_name
The LDAP server name should be the same for the DC server name. So if you are going to manually change this file, use them as the same.
I’m gonna publish some other documents for similar problems. They all are from situations like you lost your only DC and you get back on service an old backup that has a different configuration. Check them too.
Cheers everyone!