Jump to content

Enable remote desktop


Recommended Posts


Is there a script to remotely enable o provide remote support the remote desktop client and ask users permission for connection?
I have a number to remote users and would like to provide remote support to them




Link to comment
Share on other sites

  • 2 months later...
$domain = ""
$user = ""
$password = ""
#$other_user = ""
cmdkey /generic:TERMSRV/$pc /user:$domain\$User /pass:$Password
$pc = Read-Host "PC Name: "
#Start RemoteRegistry
PsExec.exe \\$pc -s -d sc start remoteregistry
Start-Sleep -Seconds 5
#Enable RDP
PsExec.exe \\$pc -s -d REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /f /v fDenyTSConnections /t REG_DWORD /d 0
Start-Sleep -Seconds 5
#Add user to group Remote Desktop Users
PsExec.exe \\$pc -s -d net localgroup "remote desktop users" "$domain\$user" /add
#Start-Sleep -Seconds 5 
#PsExec.exe \\$pc -s -d net localgroup "remote desktop users" "$domain\$other_user" /add
#Start-Sleep -Seconds 5
#Connect to PC
mstsc /v:$pc
Start-Sleep -Seconds 5
#Stop RemoteRegistry
PsExec.exe \\$pc -s -d sc stop remoteregistry

This script will enable "Remote Registry" on the remote machine
Enables the option for remote access
Adds you to the Remote Desktop Users group
Start connection
Turn off the remote registry
But you need to have the program "psexec.exe" in the folder "C:\Windows\System32" on your machine and on the remote machine 

You can add a copy of this program to the script
Copy-Item -Path "location of the programm" -Destination $pc\admin$\system32\ -Recurse -force

Link to psexec: https://technet.microsoft.com/ru-ru/sysinternals/bb897553.aspx?f=255&MSPPError=-2147217396



Edited by Jormungand
Link to comment
Share on other sites

  • 2 weeks later...
  • Staff

Hi @Jormungand,

If the Pulseway agent is installed on the remote system, then this is not required, because we have the Pulseway RD tool which allows you to join an existing active session without logging the currently logged on user off. For more details about this please check the following link.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...