Get-RDPStatus.ps1
19 Sep 2025Description
Purpose
Checks the RDP status on specified computers.
Detailed Description
Retrieves the RDP configuration status from specified computers.
Usage
Example 1
Get-RDPStatus -ComputerName "DANTOOINE"
Notes
No additional notes.
Script
# Function: Get-RDPStatus
Function Get-RDPStatus {
<#
.SYNOPSIS
Checks the RDP status on specified computers.
.DESCRIPTION
Retrieves the RDP configuration status from specified computers.
.PARAMETER ComputerName
Name or IP address of the computer(s) to check.
.EXAMPLE
Get-RDPStatus -ComputerName "DANTOOINE"
#>
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string[]]$ComputerName
)
foreach ($Computer in $ComputerName) {
try {
$Settings = Get-CimInstance -Namespace root/cimv2/TerminalServices -ClassName Win32_TerminalServiceSetting -ComputerName $Computer
[pscustomobject]@{
ComputerName = $Computer
RDPStatus = if ($Settings.AllowTSConnections -eq 1) { 'Enabled' } else { 'Disabled' }
}
} catch {
Write-Warning "Failed to get RDP status on $($Computer): $_"
}
}
}
Download
Please feel free to copy parts of the script or if you would like to download the entire script, simply click the download button. You can download the complete repository in a zip file by clicking the Download link in the menu bar on the left hand side of the page.
Report Issues
You can report an issue or contribute to this site on GitHub. Simply click the button below and add any relevant notes. I will attempt to respond to all issues as soon as possible.