Q. How can I read computer names from a text file in PowerShell?
A. To read computer names from a text file, you use the Get-Content cmdlet, which will expect to see one computer name per line. That enables usage like this:
Get-EventLog -Log Security -Newest 20 -ComputerName (gc names.txt)
Note that gc is an alias for Get-Content. The parentheses force that command to execute first, and return its output to the -computerName parameter.
Do you have a Windows PowerShell question? Find more PowerShell FAQs, articles, and other resources at windowsitpro.com/go/DonJonesPowerShell.