How To Remotely Enable Remote Desktop (RDP) Using PsExec

As in many situations the network administrator has task of connecting to remote systems to perform his duties. Ocassionally, the remote tasks become more difficult and frustrating when there are no remote tools available on the system and the remote desktop application is deactivated. Forturnately, Microsoft has provided a means for resolving such problems and therefore restoring back the hope of the administrator.

PsExec is one of the many PsTools Microsoft has provided for network administrors for the sole purpose of system administration. The following steps will show you how to activate RDP remotely from your local computer with the use of PsExec.

1.) Download the official PsTools either from microsoft directly or here

2.) Extract the downloaded file

3.) Just copy PsExec.exe from the extracted location into your executable path “C:\Windows\System32”.

4.) Open the prompt command line (start -> Run and type “cmd” + OK) and enter the following:

psexec -u {username} -p {password} \\{iP-Address} reg add “hklm\system\currentcontrolset\control\terminal server” /f /v fDenyTSConnections /t REG_DWORD /d 0

whereby:

{username} = Administrator (must be administrator)

{password} = Administrator’s password

{IP-Address} = System IP Address

psexec remote desktop activation

If not already enabled, use the following commands to enable RDP traffic through the windows firewall:

psexec \\ {iP-Address} netsh firewall set service remoteadmin enable

psexec \\ {iP-Address} netsh firewall set service remotedesktop enable

Note:

To deactivate RDP, just change “0” to “1”.

Typing “psexec” displays its usage syntax.

Usage: psexec [\\computer[,computer2[,…] | @file][-u user [-p psswd]][-n s][-l][-s|-e][-x][-i [session]][-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,… ] cmd [arguments]

computer Direct PsExec to run the application on the computer or computers specified. If you omit the computer name PsExec runs the application on the local system and if you enter a computer name of “\\*” PsExec runs the applications on all computers in the current domain.

@file Directs PsExec to run the command on each computer listed in the text file specified.

-a Separate processors on which the application can run with commas where 1 is the lowest numbered CPU. For example, to run the application on CPU 2 and CPU 4, enter: “-a 2,4”

-c Copy the specified program to the remote system for execution. If you omit this option then the application must be in the system’s path on the remote system.

-d Don’t wait for application to terminate. Only use this option for non-interactive applications.

-e Does not load the specified account’s profile.

-f Copy the specified program to the remote system even if the file already exists on the remote system.

-i Run the program so that it interacts with the desktop of the specified session on the remote system. If no session is specified the process runs in the console session.

-l Run process as limited user (strips the Administrators group and allows only privileges assigned to the Users group). On Windows Vista the process runs with Low Integrity.

-n Specifies timeout in seconds connecting to remote computers.

-p Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password.

-s Run remote process in the System account.

-u Specifies optional user name for login to remote computer.

-v Copy the specified file only if it has a higher version number or is newer on than the one on the remote system.

-w Set the working directory of the process (relative to the remote computer).

-x Display the UI on the Winlogon desktop (local system only).

-priority Specifies -low, -belownormal, -abovenormal, -high or -realtime to run the process at a different priority. Use -background to run at low memory and I/O priority on Vista.

Enjoy!


Posted in Windows, Windows 7, Windows Vista, Windows XP and tagged , , by with 3 comments.

Comments

  • B.Cole says:

    Can you use psexec to move a file from a remote machine to a local machine?

  • kj93 says:

    access is denied massage i received when i using this command

  • Marlon says:

    I’ve used the product praiirmly to transfer files between two computers via the USB cable connection. The file transfer itself works fine, but the file selection process seems to be limited to folders only. The selections can not be made down to the file level. If you have a large folder with many files, you either have to deal with all of them or none of them.