I have the following code:
& $Plinkpath -P "22" -v "User@Server" -pw $passw $commands3 | Out-File $Report -Append -Encoding utf8
This outputs a file with the information needed but I want to store the plink sentence result into a variable.
I tried:
& $Plinkpath -P "22" -v "User@Server" -pw $passw $commands > $Example
$Example = $Plinkpath -P "22" -v "User@Server" -pw $passw $commands
And nothing works :(
How can I get the command output into a variable?
$Example = plink username@hostname commandactually works. Plink is just a console application, there's nothing Plink-specific in your question.$Example = plink username@hostname commandand does not work& $Plinkpath -P 22 -v "$usr@$Server" -pw $passw $Param[0] = $Param[1]This worked for me! Thx for help!