Skip to content

Instantly share code, notes, and snippets.

@mgreenegit
Last active February 19, 2016 23:35
Show Gist options
  • Save mgreenegit/c366f14ed82c6139aa3c to your computer and use it in GitHub Desktop.
Save mgreenegit/c366f14ed82c6139aa3c to your computer and use it in GitHub Desktop.
Simple Remote Desktop DSC Config
# Run each commented section individually
# Download new modules from the DSC Resource Kit
Install-Module xRemoteDesktopAdmin, xNetworking
# Generate a Configuration MOF file
Configuration RemoteDesktop
{
Import-DscResource -ModuleName xRemoteDesktopAdmin, xNetworking
Node localhost
{
xFirewall RemoteDesktopPort3389
{
Name = 'Remote Desktop'
Group = 'Remote Desktop'
Ensure = 'Present'
Action = 'Allow'
Enabled = 'True'
Profile = 'Domain'
Direction = 'Inbound'
Protocol = 'TCP'
LocalPort = 3389
}
xRemoteDesktopAdmin EnableRemoteDesktop
{
Ensure = 'Present'
UserAuthentication = 'Secure'
}
}
}
RemoteDesktop -outputpath C:\DSC\RDP
# (WMF5) Test if the configuration is already true
Test-DscConfiguration -Path C:\DSC\RDP | fl
# Apply the Configuration
Start-DscConfiguration -Path C:\DSC\RDP -Wait -Verbose
# (WMF5) Test if the configuration is true now
Test-DscConfiguration -Path C:\DSC\RDP | fl
# Verify the Configuration
Get-DscConfiguration
# Get full list of Node details
Get-DscConfigurationStatus | fl *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment