I collect logs from the top 50 computers to analyze user information of an application called Dragon, used to dictatate text. The script I use to collect these logs I think could be much better. Anyone care to share suggestion for improvment? Point me in the right direction and I will do the rest. Please find the code pasted below.
#copying ALL directories from c:\User\ recursively, and as many of the log files #as it finds. Copies perhaps 100-1000 empty directories for every log file it finds.
$server_names = Get-Content "C:\powershell\Dragonlog\Log Grab\sept915920.txt"
Foreach ($server in $server_names){
Copy-Item \\$server\c$\Users C:\dgnlogs\top50915920\$Server -filter dragon.log -Recurse
}
#robocopy to remove redundant empty directories.
robocopy C:\dgnlogs\top50915920 C:\splunkdragonlogs\top50915920 /s /move
You can pipe together commands
Get Content | Foreach Line Run Copy-Item
RoboCopy to Clean Up