To configure Windows PowerShell to receive remote commands in DEV
http://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/
- Start Windows PowerShell with the "Run as administrator" option.
- On server: enable-psremoting
- On server: Set-ExecutionPolicy Unrestricted
- On server: Set-Item wsman:\localhost\client\trustedhosts * (allows any computer to connect)
- On server: Restart-Service WinRM
- On client: Set-ExecutionPolicy Unrestricted
- On client: Set-Item wsman:\localhost\client\trustedhosts * (allows connections to any server)
- On client: Restart-Service WinRM
To run single command
On client: Invoke-Command -ComputerName yourserver.yourdomain.com -ScriptBlock { C:\ |dir }
To run multiple commands
On client: Enter-PSSession -ComputerName yourserver.yourdomain.com
….
On client: Exit-PSSession
To run a PowerShell script remotely from a client batch file
On client: create a "C:\Local.bat" file
On client: create a "C:\Remote.ps1" file
On client in the Remote.ps1 file: enter your powershell commands that will be executed remotely, like dir C:\
On client in the Local.bat file: @powershell -command "Invoke-Command -ComputerName yourserver.yourdomain.com -FilePath ""C:\Remote.ps1"""
pause