Redirecting Start-Service output from a remote session
Posted: Tue Feb 12, 2019 6:22 am
I have a routine that starts a service on a remote server:
Invoke-command -Session $ession -ScriptBlock { Start-Service -InputObject $args[0] } -ArgumentList $svc.Name
The routine works fine.
I wanted to explore redirecting the messages that I see in the OUTPUT tab/console to a text box to give the user additional feedback.
This is an example of what I see:
WARNING: Waiting for service 'DataCaptor Interface Server (DataCaptor Interface Server)' to start...
I have tried assigning the Invoke-command to a variable but that did not seem to help.
Can someone point me in the right direction?
Thank you in advance.
Invoke-command -Session $ession -ScriptBlock { Start-Service -InputObject $args[0] } -ArgumentList $svc.Name
The routine works fine.
I wanted to explore redirecting the messages that I see in the OUTPUT tab/console to a text box to give the user additional feedback.
This is an example of what I see:
WARNING: Waiting for service 'DataCaptor Interface Server (DataCaptor Interface Server)' to start...
I have tried assigning the Invoke-command to a variable but that did not seem to help.
Can someone point me in the right direction?
Thank you in advance.