Cleaned remains and little changes to setupRDP

This commit is contained in:
2024-01-29 10:56:54 +01:00
parent 028b744a83
commit 58795930ea
2 changed files with 16 additions and 4 deletions

View File

@@ -17,8 +17,21 @@ function SetupRDP {
[bool] $enable
)
if ($enable) {
EnableRDP
# check if RPD is already enabled
$RDPEnabled = (Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections").fDenyTSConnections
if ($RDPEnabled -eq 0) {
Write-Host "RDP is already enabled!"
} else {
EnableRDP
}
} else {
DisableRDP
# Check if RDP is already disabled
$RDPEnabled = (Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections").fDenyTSConnections
if ($RDPEnabled -eq 1) {
Write-Host "RDP is already disabled!"
} else {
DisableRDP
}
}
}