Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $a = 1
- $b = 2
- New-PSSession -ComputerName MyRemoteMachineName | Out-Null
- Invoke-Command -Session (Get-PSSession) -ArgumentList($a, $b) -ScriptBlock {
- $args[0]
- $args[1]
- }
- Get-PSSession | Remove-PSSession
- $myString = "Something"
- New-PSSession -ComputerName MyRemoteComputerName | Out-Null
- $outputFromSession = Invoke-Command -Session (Get-PSSession) -ArgumentList($myString) -ScriptBlock {
- $args[0] + " " + $env:COMPUTERNAME
- }
- $outputFromSession
- Get-PSSession | Remove-PSSession
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement