I want to connect to the rdp server and execute the command on the server via command line. Is it possible to do with one line-command?
3 Answers
For Windows Server 2003 this is feasible using the "Programs" tab of the "Options" in the Microsoft Remote Desktop Connection client. There you can specify a program to run after logon in lieu of Windows Explorer. If what you want to run will work on a %SystemRoot%\system32\cmd.exe /c (command and arguments here)
then you're all set. If you need more than a single command then call a script instead.
Save the Remote Desktop client settings to a file. Pass the filename on the command line after mstsc.exe
. That's your single-command solution.
For newer versions of the Windows you'd probably have the best luck using the RemoteApp functionality in Remote Desktop Services.
-
1
-
That you would want to connect to a server via RDP, which is by its very nature GUI-centric, so that you can run a command-line command, seems to me completely counter-intuitive.
I think what you want is a remote administration tool such as psexec, or Powershell remoting.
-
1
-
2Powershell is not additional software. No more additional than RDP– Nick.McCommented Jan 2, 2017 at 0:22
Create new advance Task Scheduler with even triger:
"Run only when user is logged on" true => show window
"Start the task only if the computer is on APC power" false
Run command i.e ClearLock.exe for extra security in my situation command will be trigger automatic on connect. Or CMD.exe, Compare to short-cut in startup or in Run registry this method don't have delay in execute
Create Event: