From 58795930eae8f2c434d21b923acbcd90b1f137d6 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Mon, 29 Jan 2024 10:56:54 +0100 Subject: [PATCH] Cleaned remains and little changes to setupRDP --- setupRDP.ps1 | 15 ++++++++++++++- setupScript.ps1 | 5 ++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/setupRDP.ps1 b/setupRDP.ps1 index 2441cbd..cd71bda 100644 --- a/setupRDP.ps1 +++ b/setupRDP.ps1 @@ -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 + } } } \ No newline at end of file diff --git a/setupScript.ps1 b/setupScript.ps1 index 25e5270..1122478 100644 --- a/setupScript.ps1 +++ b/setupScript.ps1 @@ -48,7 +48,7 @@ function StandardSetup { SetupUser -username "Prof" -password "IPRprof2398" -description "Compte professeur" -group "Users" SetupUser -username "Admin" -password "Lprsnm4ehk26-" -description "Compte administrateur" -group "Administrators" SetupUserReg -username "Eleve" - EnableRDP + SetupRDP -enable 1 InstallChoco ChocoInstallApps -Type $Type InstallApps -Type $Type @@ -147,7 +147,7 @@ function SetupCustom { } } } - if ($RDP) { EnableRDP } + if ($RDP) { SetupRDP -enable 1 } if ($Choco) { InstallChoco if ($ChocoApps) { ChocoInstallApps -Type "Custom" -Apps $ChocoApps } @@ -197,5 +197,4 @@ if (Test-Path -Path "C:\Windows\System32\CodeIntegrity\CiPolicies\Active\{b4d6b2 Remove-Item -Path "C:\Windows\System32\CodeIntegrity\CiPolicies\Active\{b4d6b24c-c3ad-44e5-9dea-72c1ed9577b8}.cip" } } -OldImportModules Show-InstallationMenu \ No newline at end of file