-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added DFSR configurations and test data (#220)
- Loading branch information
Showing
11 changed files
with
196 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletions
15
source/DSCResources/DfsReplicationGroupConnections/DfsReplicationGroupConnections.psd1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
} |
42 changes: 42 additions & 0 deletions
42
...ce/DSCResources/DfsReplicationGroupConnections/DfsReplicationGroupConnections.schema.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
source/DSCResources/DfsReplicationGroupMembers/DfsReplicationGroupMembers.psd1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
} |
31 changes: 31 additions & 0 deletions
31
source/DSCResources/DfsReplicationGroupMembers/DfsReplicationGroupMembers.schema.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
source/DSCResources/DfsReplicationGroupMemberships/DfsReplicationGroupMemberships.psd1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
} |
40 changes: 40 additions & 0 deletions
40
...ce/DSCResources/DfsReplicationGroupMemberships/DfsReplicationGroupMemberships.schema.psm1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/Unit/DSCResources/Assets/Config/DfsReplicationGroupConnections.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
7 changes: 7 additions & 0 deletions
7
tests/Unit/DSCResources/Assets/Config/DfsReplicationGroupMembers.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
11 changes: 11 additions & 0 deletions
11
tests/Unit/DSCResources/Assets/Config/DfsReplicationGroupMemberships.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |