How to run remote commands

Brock Bingham candid headshot
Brock Bingham|August 31, 2023
Dog drooling while reading content on laptop
Dog drooling while reading content on laptop

There are two types of sysadmins: Those who prefer a graphical user interface (GUI) and those that have been sysadmins long enough to know better. Don’t get me wrong; a good GUI can go a long way. But with the right commands at your disposal, there’s not much you can’t do or fix. Today, we’ll take our commands to the next level by showing a few different ways to run remote commands on your managed devices.

Running remote commands the old-fashioned way

Running commands on remote computers is nothing new. Sysadmins have been tampering with supporting remote devices since before Ferris Bueller missed a day of school. But the process has changed over the years. For many, PsExec — the ever-popular Sysinternals utility — was a mandatory part of their sysadmin toolkit, allowing them to run commands and execute programs remotely.

More recently, PowerShell has made it easier than ever to run commands on remote devices. Using WinRM, sysadmins can leverage cmdlets like Invoke-Command, which is great for running single commands, and New-PSSession, which can create persistent connections to multiple remote targets simultaneously.

But… what if I told you it can get even easier to run remote commands?

Don’t let the complexity of running remote commands bumfuzzle you. Let PDQ Deploy & Inventory drastically simplify the process. Worried about your off-prem devices? Don’t be. PDQ Connect ensures any computer with an internet connection is just a few clicks away. Try them out for yourself and discover what simplified IT management looks like.

How to run remote commands with PDQ Inventory

PDQ Inventory makes it super easy to run remote commands. With all the necessary functionality baked right into the Inventory console, you’ll be firing off remote commands faster than your users can click on malicious links. Here’s how the process works.

  1. In PDQ Inventory, select a computer (or multiple computers).

  2. Right-click on the selection, then click Tools, then click Run Command.

    Click Tools, then click Run Command to open the command window.

  3. Enter your command into the command line, then hit the Execute button.

    Enter your command, then click the execute button.

When your command finishes executing, the run command window displays the output from the remote device(s).

The command window displays the results form the executed command.

There are a few other things I should point out in this window. Next to the command line, there is a drop-down option to change to a PowerShell prompt. You can also select the Multi-line option to add commands that are more than just one-liners. You can configure different settings by clicking the Options drop-down menu, such as the run as mode, the timeout settings, success codes, and more. Lastly, you can add more targets by right-clicking in the computers field in the bottom left of the window, then clicking Choose Computers.

Add targets and modify additional remote commands options.

Once you get comfortable running commands from PDQ Inventory, take things to the next level by building your own custom tools in PDQ Inventory.

How to deploy commands and scripts to remote devices with PDQ Deploy

PDQ Deploy is well known for simplifying application and patch deployments. But did you know that Deploy also makes sending out commands and scripts to on-prem devices easier than sleeping through your alarm on a Monday morning? Here’s how easy it is to distribute commands and scripts using PDQ Deploy.

  1. In PDQ Deploy, click the New Package button.

  2. Enter a name for the package, then click New Step > Command or New Step > PowerShell. In this example, I’ll use a PowerShell step.

    Add a Command or PowerShell step to your package.

  3. If you have a script already, you can click the Insert PowerShell Script link; otherwise, just enter the command into the PowerShell window.

    Add or attach your script to the command field.

  4. Click Save when finished, and close the package editor window.

With the package saved, your command or script is ready to deploy to your devices whenever needed. When you’re ready, here’s how to deploy the package to your devices.

  1. Select the package, then click Deploy Once.

  2. Enter the names of your target computers, then click Add Computer.

    Add your deployment targets.

  3. With your targets added, click Deploy Now.

That’s it. That’s the entire process. You can add as many or as few devices as you want to a deployment. You can also target collections in PDQ Inventory to ensure you’re deploying to the correct computers.

How to run commands on remote endpoints using PDQ Connect

The ability to run commands on remote endpoints is a necessity for IT departments these days, especially since the great work-from-home migration of 2020. But what about those truly hard-to-reach devices? You know, the ones whose users have never even heard of a VPN? Don’t worry; we’ve got you, fam. PDQ Connect easily deploys commands, scripts, and packages to any Windows computer with an internet connection. Here’s how to run a command against a remote computer with Connect.

  1. In PDQ Connect, click the Packages tab.

  2. Click Create package.

    Click on the Packages tab, then click Create package.

  3. Name the package.

  4. Click the drop-down arrow next to Add install step, then click Add script step.

    Add a script step to the package.

  5. Set the script type (either PowerShell or CMD). I’ll use a CMD command for this example.

  6. Click the Import link to import a script, or type your command into the scripting pane.

    Add your command or attach your script.

  7. When finished, click Save to save your package.

With your package saved, it’s ready to deploy to all those users working in Timbuktu — or Cleveland. Simply select the package you just created (it’ll be located in the Packages tab), then click Deploy. Add your devices or groups to the deployment, then click Deploy.

Add your targets to the deployment, then click Deploy.

Within minutes (more likely, seconds), your deployment speed surfs its way across the web to the targeted devices. Congrats, your remote commands have officially gone global. Next stop, deploying commands to space? One day…

Brock Bingham candid headshot
Brock Bingham

Born in the '80s and raised by his NES, Brock quickly fell in love with everything tech. With over 15 years of IT experience, Brock now enjoys the life of luxury as a renowned tech blogger and receiver of many Dundie Awards. In his free time, Brock enjoys adventuring with his wife, kids, and dogs, while dreaming of retirement.

Related articles