Can someone tell me why this invoke-command is not exporting all the variables?
icm -computername Server1 -scriptblock {
$A=$env:username;$B=hostname;$C=$env:userdomain;echo $A,$B,$C
} |
% {$_ | out-file "c:\temp\$($_.pscomputername).txt"}
The text file only contains "$C=$env:userdomain" variable. How can i export $A,$B,$C variables to the text file while keeping the $_.pscomputername as the name of the exported file?
thank you