Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
a3d2fe9
Initial config and setup
dan-hughes Oct 15, 2025
4daf3a4
Migrate RDCertificateConfiguration
dan-hughes Oct 15, 2025
3427bee
Update changelog
dan-hughes Oct 15, 2025
9210032
Enable ModuleFast
dan-hughes Oct 15, 2025
bf748e7
Formatting
dan-hughes Oct 15, 2025
e445856
Migrate MSFT_xRDConnectionBrokerHAMode
dan-hughes Oct 15, 2025
fa012a5
Add module import
dan-hughes Oct 16, 2025
e60d1ac
Merge branch 'master' into pester-5
dan-hughes Oct 16, 2025
f0fb450
GetHostByName obsolete
dan-hughes Oct 16, 2025
8562acd
Use $env:ComputerName
dan-hughes Oct 17, 2025
0658611
Merge branch 'main' into pester-5
dan-hughes Oct 17, 2025
24ff7f3
Fix HQRM
dan-hughes Oct 17, 2025
7a7b2fa
Update formatting
dan-hughes Oct 17, 2025
8aa2753
Add Indented.ScriptAnalyzerRules
dan-hughes Oct 19, 2025
137a35b
Merge branch 'main' into pester-5
dan-hughes Oct 19, 2025
a0e507d
Merge branch 'pester-5' of https://github.com/dan-hughes/xRemoteDeskt…
dan-hughes Oct 20, 2025
fc1a228
Add service name
dan-hughes Oct 20, 2025
c1357f2
Migrate RDSessionDeployment
dan-hughes Oct 20, 2025
1cb6591
Add PR 124
dan-hughes Oct 21, 2025
cf3bf49
Reformat
dan-hughes Oct 21, 2025
7d6f256
Migrate RDSessionCollectionConfiguration
dan-hughes Oct 21, 2025
5fd79ad
Fix HQRM
dan-hughes Oct 21, 2025
6ad0831
SessionCollection WIP
dan-hughes Oct 22, 2025
da9b4e2
Test local failure
dan-hughes Oct 24, 2025
0d6069e
Remove use of New-Object
dan-hughes Oct 27, 2025
69e1c7c
Migrate RDSessionCollection
dan-hughes Oct 27, 2025
7a46f46
Migrate RDServer
dan-hughes Oct 29, 2025
b782e8f
Migrate RDRemoteApp
dan-hughes Oct 29, 2025
ae4e5ca
Fix HQRM
dan-hughes Oct 30, 2025
0b15dd7
Fix types
dan-hughes Oct 30, 2025
0e9834b
Clean up
dan-hughes Oct 30, 2025
db9808e
Migrate LicenseConfiguration
dan-hughes Oct 30, 2025
7d95dd1
Rearrange assert
dan-hughes Oct 30, 2025
4bba711
Migrate GatewayConfiguration
dan-hughes Oct 30, 2025
1eb7c58
Catch exception
dan-hughes Oct 30, 2025
12bb279
Fix error
dan-hughes Oct 30, 2025
9bfbbbb
Update changelog
dan-hughes Oct 30, 2025
cf79492
Update changelog
dan-hughes Oct 30, 2025
d38d0a7
Add empty Integration test file
dan-hughes Oct 30, 2025
fc3affa
Update changelog link
dan-hughes Oct 30, 2025
41e6fbd
Remove commented code
dan-hughes Oct 30, 2025
d7c76f8
Update from comments
dan-hughes Oct 30, 2025
f010ebf
Add example
dan-hughes Oct 31, 2025
eb1a0a2
Fix test title
dan-hughes Oct 31, 2025
6927af8
Fix indent
dan-hughes Oct 31, 2025
3318ec3
Add param block and output type
dan-hughes Oct 31, 2025
84a6ac2
Use Get-ComputerName
dan-hughes Nov 2, 2025
3c02d00
Fix trailing whitespace
dan-hughes Nov 2, 2025
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
12 changes: 11 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,15 @@
"[markdown]": {
"files.trimTrailingWhitespace": true,
"files.encoding": "utf8"
}
},
"powershell.pester.useLegacyCodeLens": false,
"pester.testFilePath": [
"[tT]ests/[qQ][aA]/*.[tT]ests.[pP][sS]1",
"[tT]ests/[uU]nit/**/*.[tT]ests.[pP][sS]1",
"[tT]ests/[uU]nit/*.[tT]ests.[pP][sS]1"
],
"pester.runTestsInNewProcess": true,
"pester.pesterModulePath": "./output/RequiredModules/Pester",
"powershell.pester.codeLens": true,
"pester.suppressCodeLensNotice": true,
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed formatting in all source files, [issue #113](https://github.com/dsccommunity/xRemoteDesktopSessionHost/issues/113).
- Update repo files to latest versions in Sampler. Fixes [issue #118](https://github.com/dsccommunity/xRemoteDesktopSessionHost/issues/118).
- Enable DocGenerator and move docs to wiki. Fixes [issue #101](https://github.com/dsccommunity/xRemoteDesktopSessionHost/issues/101).
- Migrated tests to Pester 5. Fixes [issue #119](https://github.com/dsccommunity/xRemoteDesktopSessionHost/issues/119).

## [2.1.0] - 2022-08-07

Expand Down
3 changes: 2 additions & 1 deletion RequiredModules.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

InvokeBuild = 'latest'
PSScriptAnalyzer = 'latest'
Pester = '4.10.1'
Pester = 'latest'
Plaster = 'latest'
ModuleBuilder = 'latest'
ChangelogManagement = 'latest'
Expand All @@ -24,6 +24,7 @@

# Analyzer rules
'DscResource.AnalyzerRules' = 'latest'
'Indented.ScriptAnalyzerRules' = 'latest'

# Prerequisite modules for documentation.
'DscResource.DocGenerator' = 'latest'
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ stages:
inputs:
filePath: './build.ps1'
arguments: "-Tasks test -PesterScript 'tests/Unit'"
pwsh: false
pwsh: true

- task: PublishTestResults@2
displayName: 'Publish Test Results'
Expand Down
65 changes: 47 additions & 18 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,20 @@ VersionedOutputDirectory: true
####################################################
# ModuleBuilder Submodules Configuration #
####################################################

NestedModule:
DscResource.Common:
CopyOnly: true
Path: ./output/RequiredModules/DscResource.Common
AddToManifest: false
Exclude: PSGetModuleInfo.xml
xRemoteDesktopSessionHost.Common:
Prefix: prefix.ps1
VersionedOutputDirectory: false
CopyPaths:
- en-US
Encoding: UTF8
AddToManifest: false
Exclude: PSGetModuleInfo.xml

####################################################
# Sampler Pipeline Configuration #
Expand Down Expand Up @@ -48,11 +55,12 @@ BuildWorkflow:
- package_module_nupkg

hqrmtest:
- DscResource_Tests_Stop_On_Fail
- Invoke_HQRM_Tests_Stop_On_Fail

test:
- Pester_Tests_Stop_On_Fail
- Pester_if_Code_Coverage_Under_Threshold
- Convert_Pester_Coverage
- Pester_If_Code_Coverage_Under_Threshold

merge:
- Merge_CodeCoverage_Files
Expand All @@ -66,16 +74,23 @@ BuildWorkflow:
# PESTER Configuration #
####################################################
Pester:
OutputFormat: NUnitXML
Configuration:
Run:
Path:
- tests/Unit
Output:
Verbosity: Detailed
StackTraceVerbosity: Full
CIFormat: Auto
CodeCoverage:
CoveragePercentTarget: 85
OutputEncoding: ascii
UseBreakpoints: false
TestResult:
OutputFormat: NUnitXML
OutputEncoding: ascii
ExcludeFromCodeCoverage:
- Modules/DscResource.Common
Script:
- tests/Unit
ExcludeTag:
Tag:
CodeCoverageThreshold: 85
CodeCoverageOutputFileEncoding: ascii


####################################################
# Code Coverage Configuration #
Expand All @@ -91,13 +106,27 @@ CodeCoverage:
# Pester Configuration (DscResource.Test) #
####################################################
DscTest:
ExcludeTag:
- "Common Tests - New Error-Level Script Analyzer Rules"
Tag:
ExcludeSourceFile:
- output
ExcludeModuleFile:
- Modules/DscResource.Common
Pester:
Configuration:
Filter:
ExcludeTag:
- 'Common Tests - New Error-Level Script Analyzer Rules'
Output:
Verbosity: Detailed
CIFormat: Auto
TestResult:
Enabled: true
OutputFormat: NUnitXML
OutputEncoding: ascii
OutputPath: ./output/testResults/NUnitXml_HQRM_Tests.xml
Script:
ExcludeSourceFile:
- output
ExcludeModuleFile:
- Modules/DscResource.Common
# Must exclude built module file because it should not be tested like MOF-based resources
- xRemoteDesktopSessionHost.psm1
MainGitBranch: master

ModuleBuildTasks:
Sampler:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
Import-Module -Name "$PSScriptRoot\..\..\Modules\xRemoteDesktopSessionHostCommon.psm1"
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

# Import the Common Modules
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'xRemoteDesktopSessionHost.Common')
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

if (-not (Test-xRemoteDesktopSessionHostOsRequirement))
{
throw 'The minimum OS requirement was not met.'
}
Import-Module RemoteDesktop -Global
$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xRDCertificateConfiguration'

$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

#######################################################################
# The Get-TargetResource cmdlet.
Expand Down Expand Up @@ -34,6 +39,8 @@ function Get-TargetResource
$Credential
)

Assert-Module -ModuleName 'RemoteDesktop' -ImportModule

Write-Verbose -Message (
$script:localizedData.VerboseGetCertificate -f $Role, $ConnectionBroker
)
Expand Down Expand Up @@ -70,6 +77,8 @@ function Set-TargetResource
$Credential
)

Assert-Module -ModuleName 'RemoteDesktop' -ImportModule

$rdCertificateSplat = @{
Role = $Role
ConnectionBroker = $ConnectionBroker
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
Import-Module -Name "$PSScriptRoot\..\..\Modules\xRemoteDesktopSessionHostCommon.psm1"
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

# Import the Common Modules
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'xRemoteDesktopSessionHost.Common')
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

if (-not (Test-xRemoteDesktopSessionHostOsRequirement))
{
throw 'The minimum OS requirement was not met.'
}
Import-Module -Name RemoteDesktop

Assert-Module -ModuleName 'RemoteDesktop'

$localhost = [System.Net.Dns]::GetHostByName((hostname)).HostName

#######################################################################
Expand Down Expand Up @@ -31,6 +38,7 @@ function Get-TargetResource
[ValidateLength(1, 256)]
[string] $ClientAccessName
)

Write-Verbose -Message ($script:localizedData.VerboseGetHAMode -f $ConnectionBroker, $ClientAccessName)

if ([string]::IsNullOrWhiteSpace($ConnectionBroker))
Expand Down Expand Up @@ -126,6 +134,7 @@ function Test-TargetResource
[ValidateLength(1, 256)]
[string] $ClientAccessName
)

Write-Verbose ($script:localizedData.VerboseTestHAMode -f $ConnectionBroker, $ClientAccessName)

if ([string]::IsNullOrWhiteSpace($ConnectionBroker))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
Import-Module -Name "$PSScriptRoot\..\..\Modules\xRemoteDesktopSessionHostCommon.psm1"
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

# Import the Common Modules
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'xRemoteDesktopSessionHost.Common')
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

if (-not (Test-xRemoteDesktopSessionHostOsRequirement))
{
throw 'The minimum OS requirement was not met.'
}
Import-Module RemoteDesktop

Assert-Module -ModuleName 'RemoteDesktop'

function ValidateCustomModeParameters
{
Expand Down Expand Up @@ -197,7 +203,7 @@ function Set-TargetResource
Write-Verbose "Starting RD Gateway configuration for the RD deployment at broker '$ConnectionBroker'..."

# validate parameters
ValidateCustomModeParameters $GatewayMode $ExternalFqdn $LogonMethod $UseCachedCredentials $BypassLocal
ValidateCustomModeParameters -mode $GatewayMode -ExternalFqdn $ExternalFqdn -LogonMethod $LogonMethod -UseCachedCredentials $UseCachedCredentials -BypassLocal $BypassLocal

if ($GatewayServer)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
Import-Module -Name "$PSScriptRoot\..\..\Modules\xRemoteDesktopSessionHostCommon.psm1"
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

# Import the Common Modules
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'xRemoteDesktopSessionHost.Common')
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

if (-not (Test-xRemoteDesktopSessionHostOsRequirement))
{
throw 'The minimum OS requirement was not met.'
}
Import-Module RemoteDesktop

Assert-Module -ModuleName 'RemoteDesktop'

#######################################################################
# The Get-TargetResource cmdlet.
Expand Down
14 changes: 6 additions & 8 deletions source/DSCResources/MSFT_xRDRemoteApp/MSFT_xRDRemoteApp.psm1
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
$resourceModulePath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
$modulesFolderPath = Join-Path -Path $resourceModulePath -ChildPath 'Modules'
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

$rdCommonModulePath = Join-Path -Path $modulesFolderPath -ChildPath 'xRemoteDesktopSessionHostCommon.psm1'
Import-Module -Name $rdCommonModulePath

$dscResourceCommonModulePath = Join-Path -Path $modulesFolderPath -ChildPath 'DscResource.Common'
Import-Module -Name $dscResourceCommonModulePath
# Import the Common Modules
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'xRemoteDesktopSessionHost.Common')
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

if (-not (Test-xRemoteDesktopSessionHostOsRequirement))
{
throw 'The minimum OS requirement was not met.'
}
Import-Module RemoteDesktop

Assert-Module -ModuleName 'RemoteDesktop'

#######################################################################
# The Get-TargetResource cmdlet.
Expand Down
11 changes: 9 additions & 2 deletions source/DSCResources/MSFT_xRDServer/MSFT_xRDServer.psm1
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
Import-Module -Name "$PSScriptRoot\..\..\Modules\xRemoteDesktopSessionHostCommon.psm1"
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

# Import the Common Modules
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'xRemoteDesktopSessionHost.Common')
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

if (-not (Test-xRemoteDesktopSessionHostOsRequirement))
{
throw 'The minimum OS requirement was not met.'
}
Import-Module RemoteDesktop

Assert-Module -ModuleName 'RemoteDesktop'

$localhost = [System.Net.Dns]::GetHostByName((hostname)).HostName

function ValidateCustomModeParameters
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
Import-Module -Name "$PSScriptRoot\..\..\Modules\xRemoteDesktopSessionHostCommon.psm1"
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

# Import the Common Modules
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'xRemoteDesktopSessionHost.Common')
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

if (-not (Test-xRemoteDesktopSessionHostOsRequirement))
{
throw 'The minimum OS requirement was not met.'
}
Import-Module RemoteDesktop

Assert-Module -ModuleName 'RemoteDesktop'

#######################################################################
# The Get-TargetResource cmdlet.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
$resourceModulePath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent
$modulesFolderPath = Join-Path -Path $resourceModulePath -ChildPath 'Modules'
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

$rdCommonModulePath = Join-Path -Path $modulesFolderPath -ChildPath 'xRemoteDesktopSessionHostCommon.psm1'
Import-Module -Name $rdCommonModulePath

$dscResourceCommonModulePath = Join-Path -Path $modulesFolderPath -ChildPath 'DscResource.Common'
Import-Module -Name $dscResourceCommonModulePath
# Import the Common Modules
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'xRemoteDesktopSessionHost.Common')
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

if (-not (Test-xRemoteDesktopSessionHostOsRequirement))
{
throw 'The minimum OS requirement was not met.'
}
Import-Module RemoteDesktop

Assert-Module -ModuleName 'RemoteDesktop'

#######################################################################
# The Get-TargetResource cmdlet.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
Import-Module -Name "$PSScriptRoot\..\..\Modules\xRemoteDesktopSessionHostCommon.psm1"
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

# Import the Common Modules
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'xRemoteDesktopSessionHost.Common')
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

if (-not (Test-xRemoteDesktopSessionHostOsRequirement))
{
throw 'The minimum OS requirement was not met.'
}
Import-Module RemoteDesktop

Assert-Module -ModuleName 'RemoteDesktop'

#######################################################################
# The Get-TargetResource cmdlet.
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function Get-xRemoteDesktopSessionHostOsVersion
{
return [Environment]::OSVersion.Version
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function Test-xRemoteDesktopSessionHostOsRequirement
{
return (Get-xRemoteDesktopSessionHostOsVersion) -ge (New-Object 'Version' 6, 2, 9200, 0)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Localized resources for xRemoteDesktopSessionHost.Common

ConvertFrom-StringData @'
'@
Loading
Loading