Automated DFSR Backlog email

If you’re using DFSR for branch office replication, chances are you’re concerned about the number of files in the backlog queue. This page details a script I’ve been using to automate sending of emails, using a combination of blat and dfsrdiag.

To begin you’ll need to download Blat.

I suggest placing the Blat files within C:\Windows so that it’s automatically added to the system path; you could just use the full folder path when calling it though.

Here’s an example batch script I’m using for one replication group:

:: BATCH SCRIPT START
@ECHO OFF
dfsrdiag Backlog /receivingmember:hub-server /sendingmember:branch-server /rgname:domain.com\files\departments /rfname:Departments >C:\users\administrator\documents\backdept-from-branch-server.txt
FOR /R "C:\users\administrator\documents\" %%F IN (backdept-from-branch-server.txt) DO (
       IF %%~zF GTR 3000 (blat C:\users\administrator\documents\backdept-from-branch-server.txt -to email@domain.com  -server smtp.domain.com -f dfsbacklog@domain.com -subject "Backlog exists: Departments incoming from Branch-Server"))
EXIT
pause
:: BATCH SCRIPT END

 

Here’s a quick rundown on what this is doing:

dfsrdiag Backlog: this command generates a backlog report for the specified sending and receiving server, for the specified replication group, and outputs it to a text file.

This report looks like this:

Member  Backlog File Count: 1367
Backlog File Names (first 100 files)
     1. File name: DSC03752.JPG
     2. File name: DSC03786.JPG
     3. File name: DSC03794.JPG
     4. File name: DSC03796.JPG
     5. File name: DSC03809.JPG
     6. File name: DSC03810.JPG

 

The next line in the script beginning with “FOR /R”, looks for the text file just generated, and runs logic on it.

IF %%~zF GTR 3000: If the size of the backlog report text file is greater than 3KB, then generate an email to the specified people, with the text file as the message body.

Scheduling the commands

So I’ve got 16 batch files that generate reports; 2 replications groups in two transfer directions to 4 separate locations. To reduce the number of scheduled tasks, and ensure that all 16 backlog reports aren’t run at the same time, I’ve got separate batch files that call 4 at a time, and are scheduled 5 minutes apart.

Ubuntu on Hyper-V issues with Integration Services

I’ve set up a new VM with Ubuntu 10.10 server, running on our Hyper-V 2008 R2 SP1 cluster.

I followed the excellent walkthrough by Ben Armstrong here to make sure I wasn’t missing anything.

However after the install completed, I immediatly I ran into problems. Following the instructions to enable the Integration Services, after a reboot there was still no network connectivity, and I started seeing strange errors during the boot process mentioning Call Trace errors.

As well, the CPU on the VM was running at 100% constantly.

After further reboots, the VM would lock up entirely and become unresponsive.

I restarted the process, but immediately after first login made a snapshot and started looking.

Running the “top” command, I found the process ksoftirqd taking 100% of the CPU. Looking into that brought me to this forum post:

http://ubuntuforums.org/showthread.php?t=1494797

It sounds very similar to my environment, as I’m using Dell R410 with Broadcom NIC’s.
Following those instructions, I was able to disable the integration components and add a legacy network adapter. Now the VM is running just fine.

Of course, I’m going to have to set up NTP now, and accept a bit of lower performance, but in this instance, thats fine.

If I ever do find out the source of this issue, I’ll edit this post.

Find Hyper-V VM GUID

While creating and converting VM’s using SCVMM puts the configuration files and VHD’s in a nicely structured set of folders, if you create a VM through Hyper-V Manager or convert using disk2vhd, the files will be stored based on the GUID for the VM, which isn’t found anywhere in the GUI tools for Hyper-V.
Luckily I came across this blog post to which I owe full credit for the solution:

http://blogs.technet.com/b/m2/archive/2008/07/04/how-to-get-the-bios-guid-from-a-hyper-v-vm.aspx?ppud=4&wa=wsignin1.0#comments

Save the VBS script below as guid.vbs, copy to your Hyper-V host, and use psexec to execute it with this:

psexec \\hyperv cmd.exe

cscript c:\guid.vbs

You are using PSexec right?

Option Explicit
Dim WMIService
Dim KvpComponents
Dim VMList
Dim VMSettingList
Dim VM
Dim item
Dim setting
Dim component

'Get instance of 'virtualization' WMI service on the local computer
Set WMIService = GetObject("winmgmts:\\.\root\virtualization")
'Get all the MSVM_ComputerSystem object
Set VMList = WMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem")   
For Each VM In VMList  
 if VM.Caption = "Virtual Machine" then      
  WScript.Echo "========================================"      
  WScript.Echo "VM Name: " & VM.ElementName      
  WScript.Echo "VM GUID: " & VM.Name     
  WScript.Echo "VM State: " & VM.EnabledState   

  ' Now get the BIOS GUID for this VM
  Set VMSettingList = WMIService.ExecQuery("SELECT * FROM Msvm_VirtualSystemSettingData")   
  For Each setting In VMSettingList
   Dim tempVMname
   tempVMName = "Microsoft:"  + VM.Name
   if setting.InstanceID = tempVMName then      
    WScript.Echo "VM BIOS GUID: " & setting.BIOSGUID  
   end if
  Next
 end if
Next

Delegate minor Active Directory changes

There are a few values within Active Directory that we like to keep up to date. The include things such as Telephone number, Title, Manager and department. By having accurate information, our Exchange Global Address List can be used as an effective company directory and search tool.

However, placing the burden of keeping these things up to date on myself as System Administrator isn’t acceptable, especially when the information is already in the hands of someone else.

Luckily I found a way to use an MMC control to delegate changes to certain personnel.

Note: This is only tested on Windows XP

To begin, create a user group called “ADedits” or something appropriate. Assign this group to the top level User OU in your structure, with special permissions for the following attributes:

Read Name                                         
Read Display Name                                   
Read First Name                                     
Read Initials                                       
Write telephoneassistant                            
Read/write adminDescription                         
Read/write adminDisplayname                         
Read/write assistant                                
Read/write fax numbers(other)                       
Read/write mobile number (other)                    
Read/write businessCategory                         
Read/write street                                   
Read/write Notes                                    
Read/write TelephoneNumber                          
Read/Write department                               
Read/Write Description                              
Read/Write Title
Read/Write Comment                                    
Read/Write Fax Number
Read/Write Home Address
Read/Write Street Address
Read/Write Company
Read/Write Home Phone
Read/Write Home Phone (others)
Read/Write Mobile Number
Read/Write Pager Number (others)
Read/Write Phone Number (others)
Read/Write Pager Number
Read/Write roomNumber
Read/Write Post office Box
Read/Write PostalAddress
Read/Write Zip/PostalCode
Read/Write Manager

On the computers where the changes will be made, install the adminpak.msi package from here:

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c16ae515-c8f4-47ef-a1e4-a8dcbacff8e3&displaylang=en

Then create an MMC file, with the Active Directory Users and Computers snap-in. Once thats loaded, right click on the container OU for your user accounts, and select “New Window from Here”. In the window list in the MMC control, close the original window, and then save the MMC for redistribution.

Now you have a control that targets only the Users OU, secured for specified people.