powershell - Iterating through a variable line by line -
i have small script outputs text variable. need go through line 1 in order parse it. outputting variable text file , reading using get-content seems bit redundant.
my script connects fortigate unit , runs query. it's response i'm looking parse.
new-sshsession 10.0.0.138 -port 65432 -credential (get-credential) -acceptkey $command = 'config router policy show' $result = invoke-sshcommand -index 0 -command $command
by description, variable string newlines. can turn array of single-line string calling this:
$result = $result -split "`r`n"
Comments
Post a Comment