Execute a batch file on a remote server

Just looking for some tips on writing a script to execute a batch file on a remote server. I don’t to use the PsExec tool as I want users to be able to run the script easily.
I read on a technet forum that you create a process using an object to execute the batch file.

Thanks!

Hi Byron,

Please check out the Invoke-Command cmdlet to run scripts on one or more remote servers.

Get-Help Invoke-Command
Get-Help Invoke-Command -Examples

https://technet.microsoft.com/en-us/library/hh849719.aspx

Invoke-Command -ComputerName MyRemoteServer -ScriptBlock { $env:COMPUTERNAME }

Best,
Daniel

Hi Daniel

Will check out the cmdlet!

Thanks!