How to use a list of servers in a file to process operations on multiple servers
Example : I’d like to ping several servers listed in a servers.txt file :
- use get-content <filename> in between brackets after a named parameted :
Test-Connection -ComputerName (get-content servers.txt) -Count 1
You can also do the same without the parameter name if it’s a positional parameter :
Test-Connection (get-content servers.txt) -Count 1
More examples to come later…