From b97c82bc6eff7126d4a301f8f58a28ae21002c50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl?= Date: Mon, 1 Aug 2022 20:38:47 +0200 Subject: [PATCH] Adding new examples for the DSC resources in this module (#74) --- CHANGELOG.md | 5 +++ .../MSFT_xRDServer/MSFT_xRDServer.schema.mof | 1 - ...SFT_xRDSessionCollectionConfiguration.psm1 | 1 - source/Examples/README.md | 12 +++++++ .../1-CreateGatewayConfiguration.ps1 | 22 ++++++++++++ .../1-CreateLicenseServer.ps1 | 19 ++++++++++ .../xRDRemoteApp/1-CreateRemoteApp.ps1 | 27 ++++++++++++++ .../Resources/xRDServer/1-JoinRDSHost.ps1 | 19 ++++++++++ .../1-CreateSessionCollection.ps1 | 19 ++++++++++ .../1-ConfigureSessionCollection.ps1 | 36 +++++++++++++++++++ .../1-CreateSessionDeployment.ps1 | 18 ++++++++++ .../xRemoteDesktopSessionHostCommon.psd1 | 1 - source/xRemoteDesktopSessionHost.psd1 | 7 ---- ...MSFT_xRDCertificateConfiguration.tests.ps1 | 0 14 files changed, 177 insertions(+), 10 deletions(-) create mode 100644 source/Examples/Resources/xRDGatewayConfiguration/1-CreateGatewayConfiguration.ps1 create mode 100644 source/Examples/Resources/xRDLicenseConfiguration/1-CreateLicenseServer.ps1 create mode 100644 source/Examples/Resources/xRDRemoteApp/1-CreateRemoteApp.ps1 create mode 100644 source/Examples/Resources/xRDServer/1-JoinRDSHost.ps1 create mode 100644 source/Examples/Resources/xRDSessionCollection/1-CreateSessionCollection.ps1 create mode 100644 source/Examples/Resources/xRDSessionCollectionConfiguration/1-ConfigureSessionCollection.ps1 create mode 100644 source/Examples/Resources/xRDSessionDeployment/1-CreateSessionDeployment.ps1 rename {Tests => tests}/Unit/MSFT_xRDCertificateConfiguration.tests.ps1 (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1dafe6c..7aed321 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- xRemoteDesktopSessionHost + - New examples for the resources + ### Changed - xRemoteDesktopSessionHost diff --git a/source/DSCResources/MSFT_xRDServer/MSFT_xRDServer.schema.mof b/source/DSCResources/MSFT_xRDServer/MSFT_xRDServer.schema.mof index 0f3ca82..65c04e5 100644 --- a/source/DSCResources/MSFT_xRDServer/MSFT_xRDServer.schema.mof +++ b/source/DSCResources/MSFT_xRDServer/MSFT_xRDServer.schema.mof @@ -10,4 +10,3 @@ class MSFT_xRDServer : OMI_BaseResource [write] string GatewayExternalFqdn; }; - diff --git a/source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1 b/source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1 index 8e20ed9..85b4294 100644 --- a/source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1 +++ b/source/DSCResources/MSFT_xRDSessionCollectionConfiguration/MSFT_xRDSessionCollectionConfiguration.psm1 @@ -398,4 +398,3 @@ function Test-TargetResource } Export-ModuleMember -Function *-TargetResource - diff --git a/source/Examples/README.md b/source/Examples/README.md index 8c3fc25..66bf492 100644 --- a/source/Examples/README.md +++ b/source/Examples/README.md @@ -2,3 +2,15 @@ This will help to understand how to setup certain scenarios with the xRemoteDesktopSessionHost resource module. + +## Resource examples + +These are the links to the examples for each individual resource. + +- [xRDGatewayConfiguration](Resources/xRDGatewayConfiguration) +- [xRDLicenseConfiguration](Resources/xRDLicenseConfiguration) +- [xRDRemoteApp](Resources/xRDRemoteApp) +- [xRDServer](Resources/xRDServer) +- [xRDSessionCollection](Resources/xRDSessionCollection) +- [xRDSessionCollectionConfiguration](Resources/xRDSessionCollectionConfiguration) +- [xRDSessionDeployment](Resources/xRDSessionDeployment) diff --git a/source/Examples/Resources/xRDGatewayConfiguration/1-CreateGatewayConfiguration.ps1 b/source/Examples/Resources/xRDGatewayConfiguration/1-CreateGatewayConfiguration.ps1 new file mode 100644 index 0000000..355869b --- /dev/null +++ b/source/Examples/Resources/xRDGatewayConfiguration/1-CreateGatewayConfiguration.ps1 @@ -0,0 +1,22 @@ +<# + .DESCRIPTION + This example shows how to ensure that the Remote Desktop Gateway is setup. +#> + +Configuration Example +{ + Import-DscResource -ModuleName 'xRemoteDesktopSessionHost' + + Node localhost { + + xRDGatewayConfiguration MyGateway { + ConnectionBroker = 'connectionbroker.server.fqdn' + GatewayServer = 'gateway.server.fqdn' + GatewayMode = 'Automatic' + ExternalFqdn = 'gateway.external.fqdn' + LogonMethod = 'AllowUserToSelectDuringConnection' + UseCachedCredentials = $false + BypassLocal = $false + } + } +} diff --git a/source/Examples/Resources/xRDLicenseConfiguration/1-CreateLicenseServer.ps1 b/source/Examples/Resources/xRDLicenseConfiguration/1-CreateLicenseServer.ps1 new file mode 100644 index 0000000..1bf319e --- /dev/null +++ b/source/Examples/Resources/xRDLicenseConfiguration/1-CreateLicenseServer.ps1 @@ -0,0 +1,19 @@ +<# + .DESCRIPTION + This example shows how to ensure that the Remote Desktop Licensing is setup in the correct mode. +#> + +Configuration Example +{ + + Import-DscResource -ModuleName 'xRemoteDesktopSessionHost' + + Node localhost { + + xRDLicenseConfiguration MyLicenseServer { + ConnectionBroker = 'connectionbroker.server.fqdn' + LicenseMode = 'PerUser' + LicenseServer = 'license.server.fqdn' + } + } +} diff --git a/source/Examples/Resources/xRDRemoteApp/1-CreateRemoteApp.ps1 b/source/Examples/Resources/xRDRemoteApp/1-CreateRemoteApp.ps1 new file mode 100644 index 0000000..4f3e568 --- /dev/null +++ b/source/Examples/Resources/xRDRemoteApp/1-CreateRemoteApp.ps1 @@ -0,0 +1,27 @@ +<# + .DESCRIPTION + This example shows how to ensure deploy PowerShell as a RemoteApp. +#> + +Configuration Example +{ + + Import-DscResource -ModuleName 'xRemoteDesktopSessionHost' + + Node localhost { + + xRDRemoteApp 'Notepad' { + Alias = 'PowerShell without Profile' + CollectionName = 'BD_Python_Apps' + CommandLineSetting = 'Require' + DisplayName = 'PowerShell' + FilePath = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' + FolderName = '' + IconPath = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' + RequiredCommandLine = '-noprofile' + ShowInWebAccess = $True + UserGroups = '' + FileVirtualPath = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' + } + } +} diff --git a/source/Examples/Resources/xRDServer/1-JoinRDSHost.ps1 b/source/Examples/Resources/xRDServer/1-JoinRDSHost.ps1 new file mode 100644 index 0000000..85593fb --- /dev/null +++ b/source/Examples/Resources/xRDServer/1-JoinRDSHost.ps1 @@ -0,0 +1,19 @@ +<# + .DESCRIPTION + This example shows how to join a RDSH host to a deployment. +#> + +Configuration Example +{ + + Import-DscResource -ModuleName 'xRemoteDesktopSessionHost' + + Node localhost { + + xRDServer RemoteDesktopSessionHost { + ConnectionBroker = 'connectionbroker.server.fqdn' + Server = 'sessionhost.server.fqdn' + Role = 'RDS-RD-Server' + } + } +} diff --git a/source/Examples/Resources/xRDSessionCollection/1-CreateSessionCollection.ps1 b/source/Examples/Resources/xRDSessionCollection/1-CreateSessionCollection.ps1 new file mode 100644 index 0000000..f442ccc --- /dev/null +++ b/source/Examples/Resources/xRDSessionCollection/1-CreateSessionCollection.ps1 @@ -0,0 +1,19 @@ +<# + .DESCRIPTION + This example shows how to ensure a session collection is created. +#> + +Configuration Example +{ + Import-DscResource -ModuleName 'xRemoteDesktopSessionHost' + + Node localhost { + + xRDSessionCollection 'MyCollection' { + CollectionName = 'ExampleApplications' + SessionHost = 'sessionhost.server.fqdn' + ConnectionBroker = 'connectionbroker.server.fqdn' + CollectionDescription = 'A collection to deploy example applications' + } + } +} diff --git a/source/Examples/Resources/xRDSessionCollectionConfiguration/1-ConfigureSessionCollection.ps1 b/source/Examples/Resources/xRDSessionCollectionConfiguration/1-ConfigureSessionCollection.ps1 new file mode 100644 index 0000000..9257ad2 --- /dev/null +++ b/source/Examples/Resources/xRDSessionCollectionConfiguration/1-ConfigureSessionCollection.ps1 @@ -0,0 +1,36 @@ +<# + .DESCRIPTION + This example shows how to ensure a session collection is configured. +#> + +Configuration Example +{ + Import-DscResource -ModuleName 'xRemoteDesktopSessionHost' + + Node localhost { + + xRDSessionCollectionConfiguration 'ExampleApplications' { + CollectionName = 'ExampleApplications' + CollectionDescription = 'A collection to deploy example applications' + ConnectionBroker = 'connectionbroker.server.fqdn' + UserGroup = 'DOMAIN\AllowedUsersGroup' + ActiveSessionLimitMin = 0 + BrokenConnectionAction = 'Disconnect' + AutomaticReconnectionEnabled = $True + DisconnectedSessionLimitMin = 30 + IdleSessionLimitMin = 1440 # One day + TemporaryFoldersDeletedOnExit = $True + RDEasyPrintDriverEnabled = 0 + MaxRedirectedMonitors = 16 + ClientPrinterRedirected = 0 + ClientDeviceRedirectionOptions = 'AudioVideoPlayBack, AudioRecording, Clipboard' + ClientPrinterAsDefault = 0 + AuthenticateUsingNLA = $True + EncryptionLevel = 'High' + SecurityLayer = 'SSL' + EnableUserProfileDisk = $True + DiskPath = '\\file.server.fqdn\RDSProfileShare' + MaxUserProfileDiskSizeGB = 5 + } + } +} diff --git a/source/Examples/Resources/xRDSessionDeployment/1-CreateSessionDeployment.ps1 b/source/Examples/Resources/xRDSessionDeployment/1-CreateSessionDeployment.ps1 new file mode 100644 index 0000000..ece1ae8 --- /dev/null +++ b/source/Examples/Resources/xRDSessionDeployment/1-CreateSessionDeployment.ps1 @@ -0,0 +1,18 @@ +<# + .DESCRIPTION + This example shows how to ensure a session deployment is created. +#> + +Configuration Example +{ + Import-DscResource -ModuleName 'xRemoteDesktopSessionHost' + + Node localhost { + + xRDSessionDeployment RDSDeployment { + SessionHost = 'rdsessionhost.server.fqdn' + ConnectionBroker = 'connectionbroker.server.fqdn' + WebAccessServer = 'webaccess.server.fqdn' + } + } +} diff --git a/source/Modules/xRemoteDesktopSessionHostCommon.psd1 b/source/Modules/xRemoteDesktopSessionHostCommon.psd1 index 841f390..abe19a4 100644 --- a/source/Modules/xRemoteDesktopSessionHostCommon.psd1 +++ b/source/Modules/xRemoteDesktopSessionHostCommon.psd1 @@ -124,4 +124,3 @@ PrivateData = @{ # DefaultCommandPrefix = '' } - diff --git a/source/xRemoteDesktopSessionHost.psd1 b/source/xRemoteDesktopSessionHost.psd1 index 06495be..a5f1607 100644 --- a/source/xRemoteDesktopSessionHost.psd1 +++ b/source/xRemoteDesktopSessionHost.psd1 @@ -68,10 +68,3 @@ } # End of PrivateData hashtable } - - - - - - - diff --git a/Tests/Unit/MSFT_xRDCertificateConfiguration.tests.ps1 b/tests/Unit/MSFT_xRDCertificateConfiguration.tests.ps1 similarity index 100% rename from Tests/Unit/MSFT_xRDCertificateConfiguration.tests.ps1 rename to tests/Unit/MSFT_xRDCertificateConfiguration.tests.ps1