I'm having trouble running multiple commands within a Scriptblock parameter. All documentation points towards using a semicolon for separation between cmdlets. Using the same methodology of separating cmdlets via a semicolon works on my local machine, but not on a remote machine through invoke-command.
For example, the below code will only return the result of Get-Service
, and not Get-Process
.
Invoke-Command -ComputerName cas-bkupexec -ScriptBlock { Get-Service; Get-Process }
How can I achieve the desired result of both commands successfully running and receive the output of each?