- Run Command For Remote Desktop
- Remote Command Prompt
- Remote Desktop Connection Run Command
- Run Dmg From Remote Command Line Download
On occasion, I need to run a single remote command on a single system, but don’t have a tool handy (like Apple Remote Desktop’s Send Unix function) to do it. If the machine in question has SSH enabled though, there’s a simple way to do this.
Jan 26, 2019 Installing applications on macOS and OS X computers is easy to do when deploying the apps as packages through the Terminal using the Installer command for. Linux execute command remotely. Ask Question Asked 8 years. Ssh user@machine 'remote command to run' share improve this answer. 14.4k 3 3 gold badges 31 31 silver badges 60 60 bronze badges. Is there anyway to enter the password on the same line?
1. Open Terminal
2. Run the following command:
ssh username@server.domain.com 'your command here'
For example, if you wanted to use tail to display the latest entries to /var/log/system.log, you would run the following command:
ssh username@server.domain.com 'tail -f /var/log/system.log'
You’ll be prompted for a password, which will be used by SSH to log into the remote system. If the password is accepted, tail should start displaying the latest entries to /var/log/system.log as they’re written. To stop, you would hit Control-C as usual. That will stop the command’s execution and close the SSH connection automatically.
When running commands that require elevated privileges, you’ll need to add the -t flag to your SSH command. -t tells SSH to force pseudo-tty allocation, which in turn provides a way to feed your account’s password to the remote server and run the command via sudo.
For example, if you wanted to restart opendirectoryd on a remote Mac running 10.8.x, you would run the following command:
ssh -t username@server.domain.com 'sudo killall opendirectoryd'
You’ll be prompted for a password, which will be used by SSH to log into the remote system. You’ll then be prompted again for a password, which will be used by sudo to authenticate that your account is authorized to run the command with sudo. Once the command is run and completes successfully, the SSH connection closes automatically.
Ever needed to run a cmd on a remote computer such as gpupdate? this will show you how.
This of course assumes you have admin access to the remote PC
Run Command For Remote Desktop
2 Steps total
Step 1: Open an Administrative Command Prompt
Open the Command Prompt windows. Make sure you run as admin and use credentials with admin rights on the remote machine
Step 2: Run your command
Use this command.
WMIC /node:'Computer Name' process call create “cmd.exe /c GPUpdate.exe /force”
Just Replace 'Computer Name' with the name of the remote computer. To be safe keep the ' around the computer name. without the quotes some characters seem to cause issues with this command
This example will run the command GPUpdate.exe /force If you wish to run something else. replace this with the command you wish to run.
That is it. your command will execute on the remote system. The only downside to this method is that you can't see the command execute or the results if there was a error.
But in a pinch this can be a very handy command
Remote Command Prompt
References
Remote Desktop Connection Run Command
- How to run a command remotely on computers
6 Comments
Run Dmg From Remote Command Line Download
- Thai Pepperbobmccoy Mar 4, 2016 at 10:17pm
PSExec tends to be much faster. And if you have PowerShell remoting enabled, that is another option.
- DatilLaurel Raven Mar 5, 2016 at 01:11am
bobmccoy, that's true, but those are not always options. I recently had to do this (actually figured out how to do it with Invoke-WmiMethod, because I'm stubborn and wanted it to be a PowerShell solution), and in this environment, PSExec is disabled by security policy, and PS Remoting has never been enabled. I'm working on getting PS Remoting turned on, but having a backup to try for when those fail is always good.
- Macemolan Mar 5, 2016 at 02:05am
And it has the benefit of not needing to add anything to a base windows install. It is just there and enabled
- Serranojulianddavidson Mar 5, 2016 at 07:14am
Batchpatch is also good for this kind of thing. If you need to do it on lots of computers.
- Jalapenorobb4 Jul 12, 2018 at 07:50am
You'll also need to have Windows firewall already allowing WMIC in. This is not set by default. Guide to deploy the GPO is here:
https://community.spiceworks.com/how_to/17452-group-policy-to-allow-wmi-access-to-remote-machine - Thai PepperPeter (Action1) Sep 13, 2018 at 06:05pm
if you need to run an application on multiple remote computers, I would recommend to use a third-party tool - Action1 can do this: https://www.action1.com/f/Free-Run-Application-with-Command-Line-atm-65.html