PowerShell Remoting

Therefore  you can develop  cmdlet/scripts once and  remotely execute them with PowerShell   without making any changes. The only requirement being the that  cmdlet/script you wish to execute needs to be accessible on the remote computer.
For example:

PS C:\> #my current machine
PS C:\> $env:computername
PS C:\> icm winsvhelp-lh { $env:computername }
PS C:\>

In the above example $env:computername was run locally and then on a remote machine from the local machine. The command icm is an alias for invoke-command cmdlet. icm takes the following format:

Invoke-command <ExecutionContext> { <script block to run >}

winsvhelp-lh is the execution context and in this example it is a destination computer name. So, this example requests the invoke-command to run the script {$env:computername} on the remote machine.

PowerShell remoting allows you to perform almost anything on a remote machine as if it were a local machine. Although it should be noted that the Administrator of a remote machine has the control of restricting any activity via remoting.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>