Run PowerShell Script Remotely

2017-12-08T16:21:33+00:00 June 2nd, 2011|PowerShell|

If you have PowerShell 2.0 installed on machines in your environment, then you are able to execute PowerShell scripts on remote machines straight from your local machine.

First make sure you enable remote script execution on your Local and Remote machine by running the following in PowerShell.

Enable-PSRemoting –force

Now place the PowerShell script you want to execute on a location on your local machine.

Now we can run the following PowerShell command to execute the script on the remote machine Smile (Edit the below highlighted in red to match the remote machine name and the PowerShell file location)

Invoke-Command -ComputerName machinename -FilePath C:FileLocationfilename.ps1