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 (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
Leave A Comment