Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
# DFS レプリケーショングループ 作成 (名称は任意)
PS C:\Users\serverworld> New-DfsReplicationGroup -GroupName "RepGroup01"
GroupName : RepGroup01
DomainName : srv.world
Identifier : 8ecbca4d-b4e6-4dd8-9d0c-021bf46ed408
Description :
State : Normal
# レプリケーショングループのメンバーサーバーを設定
PS C:\Users\serverworld> Add-DfsrMember -GroupName "RepGroup01" -ComputerName "rx-7","rx-8"
GroupName : RepGroup01
ComputerName : RX-7
DomainName : srv.world
Identifier : f2e34cf5-46e7-4bee-8839-490271de3eb9
Description :
DnsName : rx-7.srv.world
Site : Default-First-Site-Name
NumberOfConnections : 0
NumberOfInboundConnections : 0
NumberOfOutboundConnections : 0
NumberOfInterSiteConnections : 0
NumberOfIntraSiteConnections : 0
IsClusterNode : False
State : Normal
GroupName : RepGroup01
ComputerName : RX-8
DomainName : srv.world
Identifier : abe65f68-6767-4248-840b-e219f7e45c8b
Description :
DnsName : rx-8.srv.world
Site : Default-First-Site-Name
NumberOfConnections : 0
NumberOfInboundConnections : 0
NumberOfOutboundConnections : 0
NumberOfInterSiteConnections : 0
NumberOfIntraSiteConnections : 0
IsClusterNode : False
State : Normal
# メンバーサーバー間のデータ転送方法を設定
# -SourceComputerName [ブランチ (ソース) サーバー]
# -DestinationComputerName [ハブ (宛先) サーバー]
PS C:\Users\serverworld> Add-DfsrConnection -GroupName "RepGroup01" `
-SourceComputerName "rx-7" `
-DestinationComputerName "rx-8"
GroupName : RepGroup01
SourceComputerName : RX-7
DestinationComputerName : RX-8
DomainName : srv.world
Identifier : 70c66a7b-ed17-4ac1-a505-7cf19b44485e
Enabled : True
RdcEnabled : True
CrossFileRdcEnabled : True
Description :
MinimumRDCFileSizeInKB : 64
State : Normal
GroupName : RepGroup01
SourceComputerName : RX-8
DestinationComputerName : RX-7
DomainName : srv.world
Identifier : bf7bae9c-9b66-45d3-9e19-b685ee01d7a0
Enabled : True
RdcEnabled : True
CrossFileRdcEnabled : True
Description :
MinimumRDCFileSizeInKB : 64
State : Normal
# レプリケーション対象のフォルダー作成 (任意の場所で OK)
PS C:\Users\serverworld> mkdir D:\Replica01
# レプリケーション対象のフォルダー名を設定 (名称は任意)
PS C:\Users\serverworld> New-DfsReplicatedFolder -GroupName "RepGroup01" -FolderName "Replica01"
GroupName : RepGroup01
FolderName : Replica01
DomainName : srv.world
Identifier : 892f854e-c1c4-4791-a2a6-298581472781
Description :
FileNameToExclude : {~*, *.bak, *.tmp}
DirectoryNameToExclude : {}
DfsnPath :
IsDfsnPathPublished : False
State : Normal
# ブランチサーバーのレプリケーション対象のフォルダーパスを設定
PS C:\Users\serverworld> Set-DfsrMembership -GroupName "RepGroup01" `
-FolderName "Replica01" `
-ContentPath "D:\Replica01" `
-ComputerName "rx-7" `
-PrimaryMember $True
This operation will modify the DFSR membership with domain: srv.world; replication group: "RepGroup01"; replicated folder:
"Replica01"; computer: RX-7; GUID: {2f748cfb-1b93-4122-a7c1-7cea0c2be676}.
Are you sure you want to modify this membership?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
GroupName : RepGroup01
ComputerName : RX-7
FolderName : Replica01
GroupDomainName : srv.world
ComputerDomainName : srv.world
Identifier : 2f748cfb-1b93-4122-a7c1-7cea0c2be676
DistinguishedName : CN=892f854e-c1c4-4791-a2a6-298581472781,CN=76dbfd0d-d76f-46aa-a3eb-9819ad20c6fc,CN=DFSR-LocalSett
ings,CN=RX-7,CN=Computers,DC=srv,DC=world
ContentPath : D:\Replica01
PrimaryMember : True
StagingPath : D:\Replica01\DfsrPrivate\Staging
StagingPathQuotaInMB : 4096
MinimumFileStagingSize : Size256KB
ConflictAndDeletedPath : D:\Replica01\DfsrPrivate\ConflictAndDeleted
ConflictAndDeletedQuotaInMB : 4096
ReadOnly : False
RemoveDeletedFiles : False
Enabled : True
DfsnPath :
State : Normal
# ハブサーバー (宛先) のレプリケーション対象のフォルダーパスを設定
PS C:\Users\serverworld> Set-DfsrMembership -GroupName "RepGroup01" `
-FolderName "Replica01" `
-ContentPath "D:\Replica01" `
-ComputerName "rx-8"
This operation will modify the DFSR membership with domain: srv.world; replication group: "RepGroup01"; replicated folder:
"Replica01"; computer: RX-8; GUID: {dcd385bc-e8ef-428d-905f-848c08eb25a6}.
Are you sure you want to modify this membership?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
GroupName : RepGroup01
ComputerName : RX-8
FolderName : Replica01
GroupDomainName : srv.world
ComputerDomainName : srv.world
Identifier : dcd385bc-e8ef-428d-905f-848c08eb25a6
DistinguishedName : CN=892f854e-c1c4-4791-a2a6-298581472781,CN=4995e629-71e0-4618-a5ca-f2010905747f,CN=DFSR-LocalSett
ings,CN=RX-8,CN=Computers,DC=srv,DC=world
ContentPath : D:\Replica01
PrimaryMember : False
StagingPath : D:\Replica01\DfsrPrivate\Staging
StagingPathQuotaInMB : 4096
MinimumFileStagingSize : Size256KB
ConflictAndDeletedPath : D:\Replica01\DfsrPrivate\ConflictAndDeleted
ConflictAndDeletedQuotaInMB : 4096
ReadOnly : False
RemoveDeletedFiles : False
Enabled : True
DfsnPath :
State : Normal
# レプリケーションの状態確認
PS C:\Users\serverworld> Get-DfsrCloneState
Ready
# レプリケーションフォルダーにファイルを保管して動作確認
PS C:\Users\serverworld> mkdir D:\Replica01\testfolder
PS C:\Users\serverworld> echo "Test File" > D:\Replica01\testfile.txt
PS C:\Users\serverworld> ls D:\Replica01
Directory: D:\Replica01
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2/10/2022 6:29 PM testfolder
-a---- 2/10/2022 6:29 PM 24 testfile.txt
PS C:\Users\serverworld> ssh rx-8 powershell -c "Get-ChildItem D:\Replica01"
fd3s01\serverworld@rx-8's password:
Directory: D:\Replica01
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 1/14/2021 11:13 PM testfolder
-a---- 1/14/2021 11:12 PM 24 testfile.txt
PS C:\Users\serverworld> ssh rx-8 powershell -c "echo 'Replication Test' > D:\Replica01\testfile2.txt"
fd3s01\serverworld@rx-8's password:
PS C:\Users\serverworld> ls D:\Replica01\testfolder
Directory: D:\Replica01
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2/10/2022 6:29 PM testfolder
-a---- 2/10/2022 6:29 PM 24 testfile.txt
-a---- 2/10/2022 6:49 PM 18 testfile2.txt
PS C:\Users\serverworld> cat D:\Replica01\testfile2.txt
Replication Test
|