{"componentChunkName":"component---src-templates-articles-index-jsx","path":"/articles/powershell-remotely-invoke-applications/","result":{"data":{"props":{"adsense":true,"adsenseMobile":null,"byLine":"","canonical":"https://staging.business.com/articles/powershell-remotely-invoke-applications/","content":"<p>Not all applications are created with remote execution in mind. PowerShell provides several ways to invoke applications on remote computers.</p>\n<p><picture class=\"aligncenter full\">Have you ever had an application handed to you and was told to run it on a bunch of computers? Come to find out that the app was never built that way — it was designed to only be executed locally. This might have stumped you for awhile until you realized you could run the app with various deployment tools. These tools would copy the app to your computers and execute it. However, what if that was overkill? Maybe you just want a quick way to copy the app to a few machines and get it ran. This is where PowerShell comes in handy.</picture></p>\r\n<p>PowerShell offers a few different ways to execute applications on remote computers. In this tutorial we'll show you three different ways — two use WMI and the third preferred way uses PowerShell remoting.</p>\r\n<h2>1. Create()</h2>\r\n<p>One way to run a process on a remote computer is to use the <strong>Win32_Process</strong> WMI class. Win32_Process is a WMI class that has a static method called <strong>Create()</strong>. This Create() method allows you to pass a EXE to it, which runs that EXE on the remote computer. In PowerShell, there are a couple of ways to make this happen.</p>\r\n<p>The first way is through the <strong>WMICLASS</strong> type accelerator. WMICLASS is a shortcut to enable access to all of the classes static properties and methods. Since Create() is a static method we don't actually have to instantiate a Win32_Process object at all. We can simply call the method with the EXE as the first argument and it will run.</p>\r\n<blockquote>([WMICLASS]\"MEMBERSRV1RootCIMV2:Win32_Process\").create(\"notepad.exe\")</blockquote>\r\n<p>In this instance, we're running the notepad.exe process on the computer MEMBERSRV1. However, knowing that this process is not interactive means you won't actually see notepad.exe pop up on a logged in console. Remote process execution is best left to applications that don't require interactive input anyway.</p>\r\n<h2>2. Invoke-WmiMethod</h2>\r\n<p>Next, PowerShell has the <strong>Invoke-WmiMethod</strong> cmdlet. We can again call the Create() method, but this time the method is not quite so convoluted. Using Invoke-WmiMethod is a more user-friendly way to call static methods like Create()</p>\r\n<blockquote>Invoke-WmiMethod –ComputerName MEMBERSRV1 -Class win32_process -Name create -ArgumentList \"notepad\"</blockquote>\r\n<p>Here we're accomplishing the same exact task as before. This time we're just expressing the Win32_Process class, and the parameter to Create(); the EXE itself, a little differently.</p>\r\n<h2>3. PowerShell remoting</h2>\r\n<p>Finally, we have PowerShell remoting. The previous two methods that used WMI depended on remote DCOM being enabled on the computer. This may or may not be a problem but can sometimes pose a security risk. You can also use PowerShell remoting through the <strong>Invoke-Command</strong> cmdlet to kick off a process on a remote computer as well as through <strong>WSMAN</strong>, which is a newer, more secure protocol.</p>\r\n<p>To do this, we'll use a combination of two cmdlets: Invoke-Command to give us the ability to run a command on the remote computer and <strong>Start-Process</strong> to actually execute the process.</p>\r\n<blockquote>Invoke-Command –ComputerName MEMBERSRV1 –ScriptBlock {Start-Process notepad.exe}</blockquote>\r\n<p>Invoke-Command is a PowerShell cmdlet that allows us to execute code on a remote computer just as if it were local. It has a <strong>ScriptBlock</strong> parameter that we can insert any kind of code to run locally on that remote computer. In this instance, we're using Start-Process, which runs a specific application.</p>\r\n<p>You can see that there are numerous ways to remotely invoke processes on computers with PowerShell. Start with Invoke-Command/Start-Process to see if that method gives you the results you're looking for. 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!</p>\n","docType":"article","guid":"articles_14980f7eae4c43e8af377030c215949b","lastModified":"2018-09-05T10:00:00.000Z","published":"2018-09-05T10:00:00.000Z","structuredData":null,"subtitle":"PowerShell offers several ways to invoke applications on remote computers.","template":"v1","title":"How to Remotely Invoke Applications with PowerShell","type":"article","author":{"avatar":null,"bio":"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.","name":"Adam Bertram","image":null,"slug":null,"social":{"facebook":"","linkedin":"https://www.linkedin.com/in/adambertram/","twitter":"https://twitter.com/adbertram","website":"https://www.adamtheautomator.com/"},"status":"enabled","title":null,"type":"Contributing Writer","user":{"imagePath":"https://staging.business.com/images/undefined","profile":{"company":"eGain Communications","jobTitle":"Product Management Analyst","website":""}}},"breadcrumbs":null,"channels":{"primary":{"name":"Technology","slug":"technology"},"sub":{"name":"Technology Solutions","slug":"technology-solutions"}},"meta":{"robots":"index, follow","description":"Not all applications are created with remote execution in mind. PowerShell provides several ways to invoke applications on remote computers.","title":"Remotely Invoke Applications With PowerShell - business.com"},"parsedContent":{"toc":[{"id":"1-create","title":"1. Create()"},{"id":"2-invoke-wmimethod","title":"2. Invoke-WmiMethod"},{"id":"3-powershell-remoting","title":"3. PowerShell remoting"}],"json":[{"component":"p","children":["Not all applications are created with remote execution in mind. PowerShell provides several ways to invoke applications on remote computers."]},{"component":"p","children":[{"component":"picture","props":{"className":"aligncenter full"},"children":["Have you ever had an application handed to you and was told to run it on a bunch of computers? Come to find out that the app was never built that way — it was designed to only be executed locally. This might have stumped you for awhile until you realized you could run the app with various deployment tools. These tools would copy the app to your computers and execute it. However, what if that was overkill? Maybe you just want a quick way to copy the app to a few machines and get it ran. This is where PowerShell comes in handy."]}]},{"component":"p","children":["PowerShell offers a few different ways to execute applications on remote computers. In this tutorial we'll show you three different ways — two use WMI and the third preferred way uses PowerShell remoting."]},{"component":"h2","props":{"id":"1-create"},"children":["1. Create()"]},{"component":"p","children":["One way to run a process on a remote computer is to use the ",{"component":"strong","children":["Win32_Process"]}," WMI class. Win32_Process is a WMI class that has a static method called ",{"component":"strong","children":["Create()"]},". This Create() method allows you to pass a EXE to it, which runs that EXE on the remote computer. In PowerShell, there are a couple of ways to make this happen."]},{"component":"p","children":["The first way is through the ",{"component":"strong","children":["WMICLASS"]}," type accelerator. WMICLASS is a shortcut to enable access to all of the classes static properties and methods. Since Create() is a static method we don't actually have to instantiate a Win32_Process object at all. We can simply call the method with the EXE as the first argument and it will run."]},{"component":"blockquote","children":["([WMICLASS]\"MEMBERSRV1RootCIMV2:Win32_Process\").create(\"notepad.exe\")"]},{"component":"p","children":["In this instance, we're running the notepad.exe process on the computer MEMBERSRV1. However, knowing that this process is not interactive means you won't actually see notepad.exe pop up on a logged in console. Remote process execution is best left to applications that don't require interactive input anyway."]},{"component":"h2","props":{"id":"2-invoke-wmimethod"},"children":["2. Invoke-WmiMethod"]},{"component":"p","children":["Next, PowerShell has the ",{"component":"strong","children":["Invoke-WmiMethod"]}," cmdlet. We can again call the Create() method, but this time the method is not quite so convoluted. Using Invoke-WmiMethod is a more user-friendly way to call static methods like Create()"]},{"component":"blockquote","children":["Invoke-WmiMethod –ComputerName MEMBERSRV1 -Class win32_process -Name create -ArgumentList \"notepad\""]},{"component":"p","children":["Here we're accomplishing the same exact task as before. This time we're just expressing the Win32_Process class, and the parameter to Create(); the EXE itself, a little differently."]},{"component":"h2","props":{"id":"3-powershell-remoting"},"children":["3. PowerShell remoting"]},{"component":"p","children":["Finally, we have PowerShell remoting. The previous two methods that used WMI depended on remote DCOM being enabled on the computer. This may or may not be a problem but can sometimes pose a security risk. You can also use PowerShell remoting through the ",{"component":"strong","children":["Invoke-Command"]}," cmdlet to kick off a process on a remote computer as well as through ",{"component":"strong","children":["WSMAN"]},", which is a newer, more secure protocol."]},{"component":"p","children":["To do this, we'll use a combination of two cmdlets: Invoke-Command to give us the ability to run a command on the remote computer and ",{"component":"strong","children":["Start-Process"]}," to actually execute the process."]},{"component":"blockquote","children":["Invoke-Command –ComputerName MEMBERSRV1 –ScriptBlock {Start-Process notepad.exe}"]},{"component":"p","children":["Invoke-Command is a PowerShell cmdlet that allows us to execute code on a remote computer just as if it were local. It has a ",{"component":"strong","children":["ScriptBlock"]}," parameter that we can insert any kind of code to run locally on that remote computer. In this instance, we're using Start-Process, which runs a specific application."]},{"component":"p","children":["You can see that there are numerous ways to remotely invoke processes on computers with PowerShell. Start with Invoke-Command/Start-Process to see if that method gives you the results you're looking for. 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!"]}]},"resource":null,"sponsorship":null,"thumbnail":{"path":"https://staging.business.com/images/content/5cf/f19217b4374975f8b456d/1500-0-","caption":"kikujungboy/Shutterstock","isBlurred":false},"bestPicks":null},"related":{"relatedArticles":[{"title":"PowerShell: Everything You Need to Know","canonical":"https://www.business.com/articles/powershell-everything-you-need-to-know/","slug":"powershell-everything-you-need-to-know","thumbnail":"https://www.business.com/images/content/5b8/998581039eb8f738b457b/1500-0-","dek":"What you need to know to unlock Microsoft PowerShell's full capabilities.","lastModified":"2018-09-05T17:00:00Z","published":"2018-09-05T17:00:00Z","sponsored":false},{"title":"Essential PowerShell Cmdlets For Managing Active Directory","canonical":"https://www.business.com/articles/powershell-active-directory-cmdlets/","slug":"powershell-active-directory-cmdlets","thumbnail":"https://www.business.com/images/content/5cf/90cab7b4374ab068b456f/1500-0-","dek":"Administering Active Directory is one of the most critical roles in any Windows network.","lastModified":"2018-09-04T08:00:00Z","published":"2018-09-04T08:00:00Z","sponsored":false},{"title":"Essential PowerShell Cmdlets For Auditing And Maintaining Storage","canonical":"https://www.business.com/articles/powershell-for-storage/","slug":"powershell-for-storage","thumbnail":"https://www.business.com/images/content/5d0/18e065a215ea2498b4588/1500-0-","dek":"PowerShell v5 offers some new features for managing storage.","lastModified":"2018-09-04T11:00:00Z","published":"2018-09-04T11:00:00Z","sponsored":false},{"title":"Microsoft Azure vs. Amazon Web Services: Cloud Comparison","canonical":"https://www.business.com/articles/azure-vs-aws-cloud-comparison/","slug":"azure-vs-aws-cloud-comparison","thumbnail":"https://www.business.com/images/content/5cf/ff3445a215ed86a8b459d/1500-0-","dek":"Which one is right for your business?","lastModified":"2018-05-25T07:00:00Z","published":"2018-05-25T07:00:00Z","sponsored":false},{"title":"How to Hire for Your Business","canonical":"https://www.business.com/articles/how-to-staff-business/","slug":"how-to-staff-business","thumbnail":"https://www.business.com/images/content/5ea/9c8bb9c658aee018b456c/1500-0-","dek":"Sterling Staffing Solutions CEO Stephen Carter shares his tips on staffing your business.","lastModified":"2020-07-31T15:00:00Z","published":"2018-08-16T12:00:00Z","sponsored":false},{"title":"How and When to Create and Use PowerShell Modules","canonical":"https://www.business.com/articles/powershell-modules/","slug":"powershell-modules","thumbnail":"https://www.business.com/images/content/5cf/a71415a215e501f8b457a/1500-0-","dek":"Step-by-step instructions on creating and using modules.","lastModified":"2018-09-05T08:00:00Z","published":"2018-09-05T08:00:00Z","sponsored":false},{"title":"How To Build An Interactive Menu Inside Of A PowerShell Script","canonical":"https://www.business.com/articles/powershell-interactive-menu/","slug":"powershell-interactive-menu","thumbnail":"https://www.business.com/images/content/5cf/a73019c658a06168b4568/1500-0-","dek":"PowerShell scripts aren't generally written with interactivity in mind.","lastModified":"2018-09-05T08:00:00Z","published":"2018-09-05T08:00:00Z","sponsored":false},{"title":"How to Manage File System ACLs with PowerShell","canonical":"https://www.business.com/articles/powershell-manage-file-system-acl/","slug":"powershell-manage-file-system-acl","thumbnail":"https://www.business.com/images/content/5cf/9f88e7b437486498b4568/1500-0-","dek":"Adjusting permissions on thousands of folders can be time consuming without PowerShell.","lastModified":"2018-09-05T11:00:00Z","published":"2018-09-05T11:00:00Z","sponsored":false},{"title":"How To Remove Pre-Installed Windows 10 Applications With PowerShell","canonical":"https://www.business.com/articles/remove-pre-installed-windows-10-applications-powershell/","slug":"remove-pre-installed-windows-10-applications-powershell","thumbnail":"https://www.business.com/images/content/5d0/b99037b4374d0428b4567/1500-0-","dek":"How to quickly and easily uninstall pre-installed Windows 10 apps using PowerShell.","lastModified":"2018-09-05T08:00:00Z","published":"2018-09-05T08:00:00Z","sponsored":false},{"title":"Using Lean Strategies to Achieve Team Synergy and Efficiency","canonical":"https://www.business.com/articles/lean-strategies-team-efficiency/","slug":"lean-strategies-team-efficiency","thumbnail":"https://www.business.com/images/content/5be/480e49c658a51108b458c/1500-0-","dek":"Learn more about lean manufacturing strategies and how to implement them in your business.","lastModified":"2018-11-08T08:00:00Z","published":"2018-11-08T08:00:00Z","sponsored":false},{"title":"Mobile Wallet Guide: Google Pay vs. Apple Pay vs. Samsung Pay","canonical":"https://www.business.com/articles/google-pay-vs-apple-pay-vs-samsung-pay/","slug":"google-pay-vs-apple-pay-vs-samsung-pay","thumbnail":"https://www.business.com/images/content/5c5/e0a269c658a457c8b4591/1500-0-","dek":"You no longer need to carry a bulky wallet filled with numerous credit cards or cash.","lastModified":"2018-06-21T16:06:00Z","published":"2018-06-21T16:05:00Z","sponsored":false},{"title":"How To Manage IIS Websites With PowerShell","canonical":"https://www.business.com/articles/powershell-manage-iis-websites/","slug":"powershell-manage-iis-websites","thumbnail":"https://www.business.com/images/content/5d0/07b2b7b437409688b4568/1500-0-","dek":"When setting up a new website in IIS are you still using the IIS Web Manager?","lastModified":"2018-09-06T07:00:00Z","published":"2018-09-06T07:00:00Z","sponsored":false}],"relatedReviews":[{"doc_type":"category","thumbnail":"https://staging.business.com/images/rz/5df908cc5a215e8c4a8b4568/conferencecall_Antonio_Diaz_Getty.jpg","canonical":"https://staging.business.com/categories/best-conference-call-services/","title":"The Best Conference Call Services of 2021","dek":"Which conference call service is right for your business in 2021? We review the top-rated services.","slug":"best-conference-call-services","lastModified":"2021-03-17T18:17:00Z"},{"doc_type":"category","thumbnail":"https://staging.business.com/images/rz/5df3d8695a215e58428b4570/POS_GETTY_DERO2084.jpg","canonical":"https://staging.business.com/categories/best-pos-systems/","title":"The Best POS Systems of 2021","dek":"Before you choose a POS system, check out our reviews of the best picks for 2021. ","slug":"best-pos-systems","lastModified":"2021-03-17T17:33:00Z"},{"doc_type":"category","thumbnail":"https://staging.business.com/images/rz/5e00d4787b43745d6a8b456e/Laptop_undrey_getty.jpg","canonical":"https://staging.business.com/categories/employee-monitoring-software/","title":"The Best Employee Monitoring Software of 2021","dek":"We've narrowed down the best employee monitoring software for businesses. Check out our best picks and reviews.","slug":"employee-monitoring-software","lastModified":"2021-03-05T15:40:00Z"}],"relatedSponsoredArticles":null}},"pageContext":{"displayModified":"2018-09-05T10:00:00.000Z","template":"v1","title":"How to Remotely Invoke Applications with PowerShell","meta":{"robots":"index, follow"},"docType":"articles","slug":"powershell-remotely-invoke-applications","canonical":"https://staging.business.com/articles/powershell-remotely-invoke-applications/","skipTOC":false}},"staticQueryHashes":[]}