need to run command against multiple lines in file that start with ica-tcp
- by Nick Parsells
I want to run a command on each line of a file I have, however its a bit more complicated then I originally thought.
The file contents look like this typically; however there are sometimes more connections:
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
console 1 Conn
t-rpal 48 Disc
ica-tcp#0 bpofiretest 50 Active wdica
rdp-tcp#2 a-nparsells 51 Active rdpwd
ica-tcp 65536 Listen
rdp-tcp 65537 Listen
The command I want to run is reset session ica-tcp#0. I also want to run the same command on any additional connections that start with ica-tcp that the scripts finds in the file.
How can I write a script like that in powershell?
thanks!