Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.
$comps = get-content c:\temp\servers.txt
$filepath = '\c$\path\to\file.txt'
@(foreach($comp in $comps){
(get-content \\$comp$filepath)[-20 .. -1]
}) | export-csv -notype c:\temp\output.csv
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
From novice to tech pro — start learning today.
http://technet.microsoft.com/en-us/library/ee176843.aspx
I think this will do it... Just add: "| Export-csv MyFile.csv" on the end.
[PS] C:\> foreach ($server in ("Server01","Sevrer02")) {dir \\$server\c$\Logs\*.log | foreach-object {$_ | get-content | select-object -last 20}}