Skip to content

Commit

Permalink
Added DFSR configurations and test data (#220)
Browse files Browse the repository at this point in the history
  • Loading branch information
raandree authored Dec 22, 2023
1 parent 069eab0 commit a644406
Show file tree
Hide file tree
Showing 11 changed files with 196 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- new composite to add a number of servers to a RDS deployment
- DnsSuffixes
- new resource to configure connection-specific DNS suffixes
- DfsReplicationGroupMembers
- new resource to configure DFSR group members
- DfsReplicationGroupMemberships
- new resource to configure DFSR group memberships
- DfsReplicationGroupConnections
- new resource to configure DFSR replication connections

### Changed

Expand Down
2 changes: 1 addition & 1 deletion RequiredModules.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
StorageDsc = '5.0.1'
Chocolatey = '0.0.79'
ActiveDirectoryDsc = '6.2.0'
DfsDsc = '4.4.0.0'
DFSDsc = '5.0.1'
WdsDsc = '0.11.0'
xDhcpServer = '3.1.0'
xDscDiagnostics = '2.8.0'
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@{
RootModule = 'DfsReplicationGroupConnections.schema.psm1'

ModuleVersion = '0.0.1'

GUID = '6b81b87e-3412-4a22-8b10-f06ef34e985f'

Author = 'NA'

CompanyName = 'NA'

Copyright = 'NA'

DscResourcesToExport = @('DfsReplicationGroupConnections')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
configuration DfsReplicationGroupConnections {
param (
[Parameter(Mandatory = $true)]
[hashtable[]]
$Items
)

<#
DestinationComputerName = [string]
GroupName = [string]
SourceComputerName = [string]
[DependsOn = [string[]]]
[Description = [string]]
[DomainName = [string]]
[Ensure = [string]{ Absent | Present }]
[EnsureCrossFileRDCEnabled = [string]{ Disabled | Enabled }]
[EnsureEnabled = [string]{ Disabled | Enabled }]
[EnsureRDCEnabled = [string]{ Disabled | Enabled }]
[MinimumRDCFileSizeInKB = [UInt32]]
[PsDscRunAsCredential = [PSCredential]]
#>

Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName DFSDsc

foreach ($item in $items)
{
if ($item.DestinationComputerName -eq $item.SourceComputerName)
{
Write-Warning "DestinationComputerName '$($item.DestinationComputerName)' and SourceComputerName '$($item.SourceComputerName)' cannot be the same. Skipping configuration item."
continue
}

if (-not $item.ContainsKey('Ensure'))
{
$item.Ensure = 'Present'
}

$executionName = "$($item.GroupName)__$($item.SourceComputerName)__$($item.DestinationComputerName)" -replace '[\s(){}/\\:-]', '_'
(Get-DscSplattedResource -ResourceName DFSReplicationGroupConnection -ExecutionName $executionName -Properties $item -NoInvoke).Invoke($item)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@{
RootModule = 'DfsReplicationGroupMembers.schema.psm1'

ModuleVersion = '0.0.1'

GUID = 'e37629b2-45e9-43d2-81d9-50b4bbda9f86'

Author = 'NA'

CompanyName = 'NA'

Copyright = 'NA'

DscResourcesToExport = @('DfsReplicationGroupMembers')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
configuration DfsReplicationGroupMembers {
param (
[Parameter(Mandatory = $true)]
[hashtable[]]
$Items
)

<#
ComputerName = [string]
GroupName = [string]
[DependsOn = [string[]]]
[Description = [string]]
[DomainName = [string]]
[Ensure = [string]{ Absent | Present }]
[PsDscRunAsCredential = [PSCredential]]
#>

Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName DFSDsc

foreach ($item in $items)
{
if (-not $item.ContainsKey('Ensure'))
{
$item.Ensure = 'Present'
}

$executionName = "$($item.ComputerName)__$($item.GroupName)" -replace '[\s(){}/\\:-]', '_'
(Get-DscSplattedResource -ResourceName DFSReplicationGroupMember -ExecutionName $executionName -Properties $item -NoInvoke).Invoke($item)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
@{
RootModule = 'DfsReplicationGroupMemberships.schema.psm1'

ModuleVersion = '0.0.1'

GUID = '8ed7a563-658b-40bc-8f90-c77ec85b49f1'

Author = 'NA'

CompanyName = 'NA'

Copyright = 'NA'

DscResourcesToExport = @('DfsReplicationGroupMemberships')
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
configuration DfsReplicationGroupMemberships {
param (
[Parameter(Mandatory = $true)]
[hashtable[]]
$Items
)

<#
ComputerName = [string]
FolderName = [string]
GroupName = [string]
[ConflictAndDeletedQuotaInMB = [UInt32]]
[ContentPath = [string]]
[DependsOn = [string[]]]
[DfsnPath = [string]]
[DomainName = [string]]
[EnsureEnabled = [string]{ Disabled | Enabled }]
[MinimumFileStagingSize = [string]{ Size128GB | Size128MB | Size128TB | Size16GB | Size16MB | Size16TB | Size1GB | Size1MB | Size1TB | Size256GB | Size256KB | Size256MB | Size256TB | Size2GB | Size2MB | Size2TB | Size32GB | Size32MB | Size32TB | Size4GB | Size4MB | Size4TB | Size512GB | Size512KB | Size512MB | Size512TB | Size64GB | Size64MB | Size64TB | Size8GB | Size8MB | Size8TB }]
[PrimaryMember = [bool]]
[PsDscRunAsCredential = [PSCredential]]
[ReadOnly = [bool]]
[RemoveDeletedFiles = [bool]]
[StagingPath = [string]]
[StagingPathQuotaInMB = [UInt32]]
#>

Import-DscResource -ModuleName PSDesiredStateConfiguration
Import-DscResource -ModuleName DFSDsc

foreach ($item in $items)
{
if (-not $item.ContainsKey('EnsureEnabled'))
{
$item.EnsureEnabled = 'Enabled'
}

$executionName = "$($item.ComputerName)__$($item.FolderName)__$($item.GroupName)" -replace '[\s(){}/\\:-]', '_'
(Get-DscSplattedResource -ResourceName DFSReplicationGroupMembership -ExecutionName $executionName -Properties $item -NoInvoke).Invoke($item)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Items:
- GroupName: Public
DomainName: contoso.com
SourceComputerName: server1.contoso.com
DestinationComputerName: server2.contoso.com
- GroupName: Public
DomainName: contoso.com
SourceComputerName: server1.contoso.com
DestinationComputerName: server3.contoso.com
- GroupName: Public
DomainName: contoso.com
SourceComputerName: server1.contoso.com
DestinationComputerName: server4.contoso.com
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Items:
- GroupName: Public
DomainName: contoso.com
ComputerName: server1.contoso.com
- GroupName: Public
DomainName: contoso.com
ComputerName: server2.contoso.com
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Items:
- GroupName: Public
FolderName: Test1
ContentPath: C:\Data\Test1
DomainName: contoso.com
ComputerName: server1.contoso.com
- GroupName: Public
FolderName: Test1
ContentPath: C:\Data\Test1
DomainName: contoso.com
ComputerName: server2.contoso.com

0 comments on commit a644406

Please sign in to comment.