business.com receives compensation from some of the companies listed on this page. Advertising Disclosure
World's Best Boss

Do you have the world's best boss?Enter them to win two tickets to Sandals!

BDC Hamburger Icon

MENU

Close
BDC Logo
Search Icon
Updated Jul 06, 2023

How to Remotely Invoke Applications With PowerShell

author image
Adam Bertram, Contributing Writer

Table of Contents

Open row

Have you ever been given an application and instructed to run it on various computers and systems, only to realize that it wasn’t built for multiple hosts? After all, some apps are designed to be executed only locally.

While this problem can be perplexing, many IT professionals understand that they can run an app like this with various deployment tools. These tools copy the app to the necessary computers and execute it. Although this method can solve the problem, it can be overkill. 

Fortunately, Microsoft PowerShell provides several ways to invoke applications on remote computers, giving you a quick way to copy the app to a few machines and get it running. 

How to remotely invoke applications with PowerShell

PowerShell offers various ways to execute applications on remote computers. Two methods use Windows Management Implementation (WMI), and a third process uses PowerShell remoting, the preferred method.

Create() method.

The Win32_Process WMI class is one way to run a process on a remote computer. Similar to how you might use PowerShell to manage IIS (a way to host websites on remote computers), you can use PowerShell to run programs on other computers.

Win32_Process is a WMI class with a static method called Create(), which allows you to pass an EXE to it and run it on the remote computer using the WMICLASS-type accelerator.

WMICLASS is a shortcut to enable access to all of the class’s static properties and methods. Because Create() is a static method, you don’t actually have to initiate a Win32_Process object at all. You can simply call the method with the EXE as the first argument, and it will run.

([WMICLASS]”MEMBERSRV1RootCIMV2:Win32_Process”).create(“notepad.exe”)

In this instance, you’re running the Notepad.exe process on the computer MEMBERSRV1. However, this process is not interactive, so you won’t see Notepad.exe pop up on a logged-in console. Remote process execution is best for applications that don’t require interactive input.

Did You Know?Did you know

The WMICLASS-type accelerator makes running EXEs on remote computers more streamlined and less prone to error.

Invoke-WmiMethod cmdlet

You can also use the Invoke-WmiMethod cmdlet, which is a less-convoluted process. Invoke-WmiMethod is a more user-friendly way to call static methods such as Create().

Invoke-WmiMethod –ComputerName MEMBERSRV1 -Class win32_process -Name create -ArgumentList “notepad”

This accomplishes the same goal. However, you’re expressing the Win32_Process class and the parameter to Create() — the EXE itself — slightly differently.

FYIDid you know

The Invoke-WmiMethod cmdlet makes remote application invocation more manageable, which is helpful for more complex operations.

PowerShell remoting

PowerShell remoting will likely be your preferred option for remotely invoking applications. The previous two methods using WMI depended on remote DCOM being enabled on the computer. This may or may not be a problem, but it can sometimes pose a security risk. 

You can use PowerShell remoting through the Invoke-Command cmdlet to kick off a process on a remote computer. (You can also use WSMan, a newer, more secure protocol.)

To do this, use a combination of two cmdlets: Invoke-Command to enable you to run a command on the remote computer, and Start-Process to execute the process.

Invoke-Command –ComputerName MEMBERSRV1 –ScriptBlock {Start-Process notepad.exe}

Invoke-Command is a PowerShell cmdlet that allows you to execute code on a remote computer as if it were local. This process has a script block parameter to insert any code to run locally on that remote computer. In this instance, you’re using Start-Process, which runs a specific application.

Did You Know?Did you know

The Invoke-Command cmdlet does more than remotely launch applications. This versatile scripting tool can also enable you to remotely sync commands with PowerShell.

PowerShell provides numerous ways to invoke processes on remote computers. Start with Invoke-Command/Start-Process to see if that method gives you the results you need. If not, you might need to look into the older methods of using WMI. At least one of these methods will get that process running remotely.

TipBottom line

If the Invoke-Command/Start-Process doesn’t produce the desired results, revert to the WMI method.

The benefits of using PowerShell to access applications

Using PowerShell to invoke applications on remote computers has three primary benefits:

  • PowerShell remoting saves administrators time and resources. Administrators can execute operations on remote computers without being there in person. This saves time and reduces the need for on-site support.
  • PowerShell remoting helps you solve problems. Invoking applications remotely means you can resolve problems wherever you are and make any necessary changes to specific applications.
  • PowerShell remoting makes updates easier. Using PowerShell to access applications makes distributing software and updates simpler, faster and more efficient. Many larger companies use this approach to save time.

Mark Fairlie contributed to this article.

author image
Adam Bertram, Contributing Writer
Adam Bertram is a 20-year veteran of IT and experienced online business professional. He's an entrepreneur, IT influencer, Microsoft MVP, blogger, trainer and content marketing writer for multiple technology companies. Adam is also the founder of the popular IT career development platform TechSnips. Catch up on Adam's articles at adamtheautomator.com, connect on LinkedIn, or follow him on Twitter at @adbertram or the TechSnips Twitter account at @techsnips_io.
BDC Logo

Get Weekly 5-Minute Business Advice

B. newsletter is your digest of bite-sized news, thought & brand leadership, and entertainment. All in one email.

Back to top