Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm in the process of making a script to automate DFS creation and replication for an exam I have next week.

So, assuming I have a namespace:

dfsutil root adddom \\Foo\bar 'My namespace'

And I have a link:

dfsutil link add \\Foo\Bar\CoolStuff \\Server2\CoolStuff 'Neat stuff'

How can I use the command line to replicate \\Server2\CoolStuff over, say, \\Server3\CoolStuff? When I use dfscmd:

dfscmd /add \\Foo\Bar\CoolStuff \\Server3\CoolStuff

It says it ended correctly, but opening up the MMC shows that there are no replication groups for CoolStuff.

Thanks!

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

I ended up finding out about dfsradmin and made it work. This thread gave me what I needed (the following is provided as a reference in case the site ever goes down; of course I had to change the names):

# Add the namespace server
dfsutil /AddFTRoot /Server:%SERVER% /Share:SharedData

# Add Folder Targets from said server
dfscmd /add \\domain\SharedData\%SITE%\users$ \\%SERVER%\users$

# Add Folder Targets from Hub Server
dfscmd /add \\domain\SharedData\%SITE%\users$ \\HubServer\SharedData\%SITE%\users$

# Add Replication Group Info as per DFSRAdmin.doc
dfsradmin RG New /rgname:"%SERVER% Data$" /rgdesc:"%SERVER% Data$ DFS Replication Link"
dfsrAdmin RG Set Schedule full /RGName:"%SERVER% Data$"
dfsradmin member new /rgname:"%SERVER% Data$" /memname:HubServer
dfsradmin member new /rgname:"%SERVER% Data$" /memname:%SERVER%
dfsradmin conn new /rgname:"%SERVER% Data$" /SendMem:HubServer /RecvMem:%SERVER% /ConnEnabled:true /ConnKeywords:"From HubServer TO %SERVER%"
dfsradmin conn new /rgname:"%SERVER% Data$" /SendMem:%SERVER% /RecvMem:HubServer /ConnEnabled:true /ConnKeywords:"%SERVER% TO HubServer"
dfsradmin RF New /rgName:"%SERVER% Data$" /RfName:Data$ /RfDfsPath:"namespace\folder\path"
dfsradmin Membership Set /RgName:"%SERVER% Data$" /RfName:Data$ /MemName:HubServer /LocalPath:D:\DFS_ROOT\SharedData\%SITE%\Data$ /MembershipEnabled:true /StagingSize:1000 /CDSize:350 /IsPrimary:true
dfsradmin Membership Set /RgName:"%SERVER% Data$" /RfName:Data$ /MemName:%SERVER% /LocalPath:D:\Data$ /MembershipEnabled:true /StagingSize:1000 /CDSize:350 /IsPrimary:false
share|improve this answer
add comment

Following Batch replicates between 2 Servers, and makes the destination read only (for users).

SET DFSR_GROUP_NAME=Server1toServer2
SET SOURCE_SERVER=SERVER1NAME
SET SOURCE_PATH=D:\
SET DESTINATION_SERVER=SERVER2NAME
SET DESTINATION_PATH=D:\SERVER2BACKUP\D
SET SCHEDULE=full
REM **** BELOW DO NOT EDIT ***
@echo off
cls
echo Erstelle DFS Replikation zwischen %SOURCE_SERVER% und %DESTINATION_SERVER%
echo.
pause
cls
echo Bitte Warten...
echo.
ping 127.0.0.1 -n 3 > NUL
dfsradmin RG New /rgname:"%DFSR_GROUP_NAME%"
dfsrAdmin RG Set Schedule full /RGName:"%DFSR_GROUP_NAME%"
dfsradmin member new /rgname:"%DFSR_GROUP_NAME%" /memname:%SOURCE_SERVER%
dfsradmin member new /rgname:"%DFSR_GROUP_NAME%" /memname:%DESTINATION_SERVER%
dfsradmin conn new /rgname:"%DFSR_GROUP_NAME%" /SendMem:%SOURCE_SERVER% /RecvMem:%
DESTINATION_SERVER% /ConnEnabled:true
dfsradmin conn new /rgname:"%DFSR_GROUP_NAME%" /SendMem:%DESTINATION_SERVER% /RecvMem:%SOURCE_SERVER% /ConnEnabled:true
dfsradmin RF New /rgName:"%DFSR_GROUP_NAME%" /RfName:DFS_SYNC
dfsradmin Membership Set /RgName:"%DFSR_GROUP_NAME%" /RfName:DFS_SYNC /MemName:%SOURCE_SERVER% /LocalPath:%SOURCE_PATH% /MembershipEnabled:true /IsPrimary:true
dfsradmin Membership Set /RgName:"%DFSR_GROUP_NAME%" /RfName:DFS_SYNC /MemName:%DESTINATION_SERVER% /LocalPath:%DESTINATION_PATH% /MembershipEnabled:true /RO:True /IsPrimary:false

REM Defines the value for each 15 min-interval in sets of 4, 
REM where each set represents one hour x 24 hours, where 0=off and f=on, 
REM and numbers represent bandwidth throttling (for example, 1=64kbps, 2=128kbps, and so on)

echo Warte 2 Minuten...

ping 127.0.0.1 -n 120 > NUL

echo Erstelle Replikationszeitraum...

dfsradmin RG Set Sched Custom /RgName:%DFSR_GROUP_NAME% /Day:Monday /Schedule:3333,3333,3333,3333,2222,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,2222,3333,3333,3333
dfsradmin RG Set Sched Custom /RgName:%DFSR_GROUP_NAME% /Day:Tuesday /Schedule:3333,3333,3333,3333,2222,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,2222,3333,3333,3333
dfsradmin RG Set Sched Custom /RgName:%DFSR_GROUP_NAME% /Day:Wednesday /Schedule:3333,3333,3333,3333,2222,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,2222,3333,3333,3333
dfsradmin RG Set Sched Custom /RgName:%DFSR_GROUP_NAME% /Day:Thursday /Schedule:3333,3333,3333,3333,2222,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,2222,3333,3333,3333
dfsradmin RG Set Sched Custom /RgName:%DFSR_GROUP_NAME% /Day:Friday /Schedule:3333,3333,3333,3333,2222,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,1111,2222,3333,3333,3333
dfsradmin RG Set Sched Custom /RgName:%DFSR_GROUP_NAME% /Day:Saturday /Schedule:3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333
dfsradmin RG Set Sched Custom /RgName:%DFSR_GROUP_NAME% /Day:Sunday /Schedule:3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333,3333
pause

exit
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.