如何使用命令行配置 DFS 复制?

如何使用命令行配置 DFS 复制?

我正在编写一个脚本来自动创建和复制 DFS,以便进行下周的考试。

因此,假设我有一个命名空间:

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

我有一个链接:

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

我如何使用命令行进行复制\\Server2\CoolStuff\\Server3\CoolStuff当我使用dfscmd

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

它说它正确结束了,但是打开 MMC 显示 CoolStuff 没有复制组。

谢谢!

答案1

我最终发现了它dfsradmin并让它发挥作用。此主题给了我所需要的(以下内容作为参考,以防网站出现故障;当然我必须更改名称):

# 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

答案2

以下批处理在两台服务器之间进行复制,并使目标变为只读(对于用户而言)。

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

相关内容