Hello All,
I have learned alot of great things in the last few weeks on my powershell journey. Now one challenge I face right now is understanding how to use variables with the invoke-command. Now from my knowledge I understand invoke-command executes commands on the remote machines.
Therefore any variables that have been defined in a script on a local machine will not be picked up.
So for example
$ServerName = StarShip
Invoke-Command -ComputerName $ServerName { get-process -ComputerName}
So as you can see I am passing variables that can be mapped locally. So my question is how does one map variables inside the bubble of invoke-command. So invoke-command will see the variables and execute accordingly.
Many thanks
FishandChips.