Iterating through a variable line by line
I have a small script that outputs text to a variable. I need to go through it one at a time to disassemble it. I could do this by dumping the variable into a text file and then reading it with Get-Content, but that seems a bit redundant.
My script connects to the Fortigate block and fires a specific request. This answer is what I am looking for to analyze.
New-SshSession 10.0.0.138 -Port 65432 -Credential (Get-Credential) -AcceptKey
$command = 'config router policy
show'
$result = Invoke-SSHCommand -Index 0 -Command $command
+3
source to share