Skip to content

Commit

Permalink
New ReplicationGroup sample, fixes to TargetState descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Borgquite committed Jan 24, 2023
1 parent d67bf3f commit cf2ee03
Show file tree
Hide file tree
Showing 5 changed files with 130 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'
Specifies if the DFS Namespace root should exist.
.PARAMETER TargetState
Specifies a State for the root of a DFS namespace.
Specifies the state of the DFS namespace folder target.
#>
function Get-TargetResource
{
Expand Down Expand Up @@ -140,7 +140,7 @@ function Get-TargetResource
Specifies if the DFS Namespace root should exist.
.PARAMETER TargetState
Specifies the target's referral status.
Specifies the state of the DFS namespace folder target.
.PARAMETER Description
The description of the DFS Namespace.
Expand Down Expand Up @@ -426,7 +426,7 @@ function Set-TargetResource
Specifies if the DFS Namespace root should exist.
.PARAMETER TargetState
Specifies the target's referral status.
Specifies the state of the DFS namespace folder target.
.PARAMETER Description
The description of the DFS Namespace.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class DSC_DFSNamespaceFolder : OMI_BaseResource
[Key, Description("Specifies a path for the root of a DFS namespace.")] String Path;
[Key, Description("Specifies a path for a root target of the DFS namespace.")] String TargetPath;
[Write, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Specifies the target's referral status."), ValueMap{"Offline","Online"}, Values{"Offline","Online"}] String TargetState;
[Write, Description("Specifies the state of the DFS namespace folder target."), ValueMap{"Offline","Online"}, Values{"Offline","Online"}] String TargetState;
[Write, Description("The description of the DFS Namespace.")] String Description;
[Write, Description("Indicates whether a DFS namespace server provides a client only with referrals that are in the same site as the client.")] Boolean EnableInsiteReferrals;
[Write, Description("Indicates whether a DFS namespace uses target failback.")] Boolean EnableTargetFailback;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ $script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'
Specifies if the DFS Namespace root should exist.
.PARAMETER TargetState
Specifies a State for the root of a DFS namespace.
Specifies the state of the DFS namespace root target.
.PARAMETER Type
Specifies the type of a DFS namespace as a Type object.
Expand Down Expand Up @@ -152,7 +152,7 @@ function Get-TargetResource
Specifies if the DFS Namespace root should exist.
.PARAMETER TargetState
Specifies a State for the root of a DFS namespace.
Specifies the state of the DFS namespace root target.
.PARAMETER Type
Specifies the type of a DFS namespace as a Type object.
Expand Down Expand Up @@ -495,7 +495,7 @@ function Set-TargetResource
Specifies if the DFS Namespace root should exist.
.PARAMETER TargetState
Specifies a State for the root of a DFS namespace.
Specifies the state of the DFS namespace root target.
.PARAMETER Type
Specifies the type of a DFS namespace as a Type object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class DSC_DFSNamespaceRoot : OMI_BaseResource
[Key, Description("Specifies a path for the root of a DFS namespace.")] String Path;
[Key, Description("Specifies a path for a root target of the DFS namespace.")] String TargetPath;
[Write, Description("Specifies if the DFS Namespace root should exist."), ValueMap{"Present","Absent"}, Values{"Present","Absent"}] String Ensure;
[Write, Description("Specifies a state for a root target of the DFS namespace."), ValueMap{"Offline","Online"}, Values{"Offline","Online"}] String TargetState;
[Write, Description("Specifies the state of the DFS namespace root target."), ValueMap{"Offline","Online"}, Values{"Offline","Online"}] String TargetState;
[Required, Description("Specifies the type of a DFS namespace as a Type object."), ValueMap{"Standalone","DomainV1","DomainV2"}, Values{"Standalone","DomainV1","DomainV2"}] String Type;
[Write, Description("The description of the DFS Namespace.")] String Description;
[Write, Description("Indicates whether a DFS namespace uses cost-based selection.")] Boolean EnableSiteCosting;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
<#PSScriptInfo
.VERSION 1.0.0
.GUID 53b67a3b-2508-490f-94e5-844d4be558f6
.AUTHOR DSC Community
.COMPANYNAME DSC Community
.COPYRIGHT Copyright the DSC Community contributors. All rights reserved.
.TAGS DSCConfiguration
.LICENSEURI https://github.com/dsccommunity/DfsDsc/blob/main/LICENSE
.PROJECTURI https://github.com/dsccommunity/DfsDsc
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES First version.
.PRIVATEDATA 2016-Datacenter,2016-Datacenter-Server-Core
#>

#Requires -module DfsDsc

<#
.DESCRIPTION
Create a DFS Replication Group called Public containing members defined separately,
FileServer1 and FileServer2. The Replication Group contains a single folder called Software.
A description will be set on the Software folder and it will be set to exclude the directory Temp
from replication. Create a two-way connection between the two nodes.
#>
Configuration DFSReplicationGroup_Separate_Simple_Config
{
param
(
[Parameter()]
[PSCredential]
$Credential
)

Import-DscResource -Module DFSDsc

Node localhost
{
<#
Install the Prerequisite features first
Requires Windows Server 2012 R2 Full install
#>
WindowsFeature RSATDFSMgmtConInstall
{
Ensure = 'Present'
Name = 'RSAT-DFS-Mgmt-Con'
}

# Configure the Replication Group
DFSReplicationGroup RGPublic
{
GroupName = 'Public'
Description = 'Public files for use by all departments'
Ensure = 'Present'
Folders = 'Software'
PSDSCRunAsCredential = $Credential
DependsOn = '[WindowsFeature]RSATDFSMgmtConInstall'
} # End of RGPublic Resource

DFSReplicationGroupMember RGPublicMemberFS1
{
GroupName = 'Public'
ComputerName = 'FileServer1'
Ensure = 'Present'
PSDSCRunAsCredential = $Credential
DependsOn = '[DFSReplicationGroup]RGPublic'
} # End of RGPublicMemberFS1 Resource

DFSReplicationGroupMember RGPublicMemberFS2
{
GroupName = 'Public'
ComputerName = 'FileServer2'
Ensure = 'Present'
PSDSCRunAsCredential = $Credential
DependsOn = '[DFSReplicationGroup]RGPublic'
} # End of RGPublicMemberFS2 Resource

DFSReplicationGroupFolder RGSoftwareFolder
{
GroupName = 'Public'
FolderName = 'Software'
Description = 'DFS Share for storing software installers'
DirectoryNameToExclude = 'Temp'
PSDSCRunAsCredential = $Credential
DependsOn = '[DFSReplicationGroup]RGPublic'
} # End of RGPublic Resource

DFSReplicationGroupMembership RGPublicSoftwareFS1
{
GroupName = 'Public'
FolderName = 'Software'
ComputerName = 'FileServer1'
ContentPath = 'd:\Public\Software'
StagingPathQuotaInMB = 4096
PrimaryMember = $true
PSDSCRunAsCredential = $Credential
DependsOn = '[DFSReplicationGroupMember]RGPublicMemberFS1', '[DFSReplicationGroupFolder]RGSoftwareFolder'
} # End of RGPublicSoftwareFS1 Resource

DFSReplicationGroupMembership RGPublicSoftwareFS2
{
GroupName = 'Public'
FolderName = 'Software'
ComputerName = 'FileServer2'
ContentPath = 'e:\Data\Public\Software'
StagingPathQuotaInMB = 4096
PSDSCRunAsCredential = $Credential
DependsOn = '[DFSReplicationGroupMember]RGPublicMemberFS2', '[DFSReplicationGroupFolder]RGSoftwareFolder'
} # End of RGPublicSoftwareFS2 Resource

DFSReplicationGroupConnection "RGPublicConnectionFS1"
{
GroupName = 'Public'
Ensure = 'Present'
SourceComputerName = 'FileServer1'
DestinationComputerName = 'FileServer2'
PSDSCRunAsCredential = $Credential
DependsOn = '[DFSReplicationGroupFolder]RGSoftwareFolder'
} # End of RGPublicConnectionFS1 Resource
} # End of Node
} # End of Configuration

0 comments on commit cf2ee03

Please sign in to comment.