Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- `RDSessionDeployment`
- Converted to class-based resource [Issue #151](https://github.com/dsccommunity/RemoteDesktopServicesDsc/issues/151).
- Converted to class-based resource [issue #151](https://github.com/dsccommunity/RemoteDesktopServicesDsc/issues/151).
- WebAccessServer is now NOT a required parameter, mirroring the use
of the underlying cmdlet.
- `RDConnectionBrokerHAMode`
- Converted to class-based resource [issue #144](https://github.com/dsccommunity/RemoteDesktopServicesDsc/issues/144).

### Fixed

- `RDSessionDeployment`
- Let base class add the key properties [Issue #153](https://github.com/dsccommunity/RemoteDesktopServicesDsc/issues/153).
- Let base class add the key properties [issue #153](https://github.com/dsccommunity/RemoteDesktopServicesDsc/issues/153).

## [4.1.0] - 2026-03-23

Expand Down
1 change: 1 addition & 0 deletions RequiredModules.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
Pester = 'latest'
Plaster = 'latest'
ModuleBuilder = 'latest'
Configuration = 'latest' # temporary until PSGallery upload is fixed
Comment thread
dan-hughes marked this conversation as resolved.
ChangelogManagement = 'latest'
Sampler = 'latest'
'Sampler.GitHubTasks' = 'latest'
Expand Down
2 changes: 1 addition & 1 deletion Resolve-Dependency.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
AllowPrerelease = $false
WithYAML = $true

UseModuleFast = $true
# UseModuleFast = $true
#ModuleFastVersion = '0.1.2'
#ModuleFastBleedingEdge = $true

Expand Down
157 changes: 157 additions & 0 deletions source/Classes/020.RDConnectionBrokerHAMode.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
<#
.SYNOPSIS
The `RDConnectionBrokerHAMode` DSC resource is used to configure the Remote Desktop Connection Broker HA.

.DESCRIPTION
This resource is used to configure the Remote Desktop Connection Broker HA.

## Requirements

- Target machine must be running Windows Server 2012 or later.

## Known issues

All issues are not listed here, see [all open issues](https://github.com/dsccommunity/RemoteDesktopServicesDsc/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+RDConnectionBrokerHAMode).

.PARAMETER ClientAccessName
Specifies the Client Access Name for the RD Connection Broker HA deployment.

.PARAMETER DatabaseConnectionString
Specifies the primary database connection string for the RD Connection Broker HA deployment.

.PARAMETER DatabaseSecondaryConnectionString
Specifies the secondary database connection string for the RD Connection Broker HA deployment.

.PARAMETER DatabaseFilePath
Specifies the file path for the RD Connection Broker HA database.

.PARAMETER ConnectionBroker
Specifies the FQDN of a server to host the RD Connection Broker role service.

.PARAMETER ActiveManagementServer
Returns the FQDN of the server that is currently active for management tasks.

.PARAMETER Reasons
Returns the reason a property is not in desired state.
#>

[DscResource(RunAsCredential = 'Optional')]
class RDConnectionBrokerHAMode : ResourceBase
{
[DscProperty(Key)]
[ValidateLength(1, 256)]
[System.String]
$ClientAccessName

[DscProperty()]
[System.String]
$ConnectionBroker

[DscProperty(Mandatory)]
[System.String]
$DatabaseConnectionString

[DscProperty()]
[System.String]
$DatabaseSecondaryConnectionString

[DscProperty()]
[System.String]
$DatabaseFilePath

[DscProperty(NotConfigurable)]
[System.String]
$ActiveManagementServer

[DscProperty(NotConfigurable)]
[RDSReason[]]
$Reasons

RDConnectionBrokerHAMode () : base ($PSScriptRoot)
{
$this.ExcludeDscProperties = @(
'ConnectionBroker'
)
}

[RDConnectionBrokerHAMode] Get()
{
# Call the base method to return the properties.
return ([ResourceBase] $this).Get()
}

[void] Set()
{
# Call the base method to enforce the properties.
([ResourceBase] $this).Set()
}

[System.Boolean] Test()
{
# Call the base method to test all of the properties that should be enforced.
return ([ResourceBase] $this).Test()
}

# Base method Get() call this method to get the current state as a Hashtable.
hidden [System.Collections.Hashtable] GetCurrentState([System.Collections.Hashtable] $properties)
{
$getParameters = @{
ConnectionBroker = $this.ConnectionBroker
ErrorAction = 'SilentlyContinue'
}

if ([string]::IsNullOrWhiteSpace($this.ConnectionBroker))
{
$getParameters.ConnectionBroker = (Get-ComputerName -FullyQualifiedDomainName)
}

$currentStateResult = Get-RDConnectionBrokerHighAvailability @getParameters

return @{
DatabaseConnectionString = $currentStateResult.DatabaseConnectionString
DatabaseSecondaryConnectionString = $currentStateResult.DatabaseSecondaryConnectionString
DatabaseFilePath = $currentStateResult.DatabaseFilePath
ActiveManagementServer = $currentStateResult.ActiveManagementServer
}
}

<#
Base method Set() call this method with the properties that should be
enforced and that are not in desired state.
#>
hidden [void] Modify([System.Collections.Hashtable] $properties)
{
# If the ActiveManagementServer property is not empty, then the configuration is currently active and cannot be modified.
if (-not [string]::IsNullOrEmpty($this.ActiveManagementServer))
{
New-InvalidOperationException -Message $this.localizedData.RDConnectionBrokerHAMode_ConfigurationCannotBeModified
}

$setParameters = @{
ClientAccessName = $this.ClientAccessName
ConnectionBroker = $this.ConnectionBroker
}

if ([string]::IsNullOrWhiteSpace($this.ConnectionBroker))
{
$setParameters.ConnectionBroker = (Get-ComputerName -FullyQualifiedDomainName)
}

Set-RDConnectionBrokerHighAvailability @setParameters @properties
}

<#
Base method Assert() call this method with the properties that was assigned
a value.
#>
hidden [void] AssertProperties([System.Collections.Hashtable] $properties)
{
if (-not (Test-RemoteDesktopServicesDscOsRequirement))
{
New-InvalidOperationException -Message $this.localizedData.RDConnectionBrokerHAMode_OSRequirementNotMet
}

# Module Import in verbose mode outputs lots of data, so redirecting to null.
Import-RemoteDesktopModule 4> $null
}
}
2 changes: 1 addition & 1 deletion source/Classes/020.RDSessionDeployment.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Returns the reason a property is not in desired state.
#>

[DscResource()]
[DscResource(RunAsCredential = 'Optional')]
class RDSessionDeployment : ResourceBase
{
[DscProperty(Key)]
Expand Down

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions source/DSCResources/DSC_RDConnectionBrokerHAMode/README.md

This file was deleted.

This file was deleted.

Loading