-1

我从前 50 台计算机收集日志来分析一个名为 Dragon 的应用程序的用户信息,该应用程序用于听写文本。我用来收集这些日志的脚本我认为可能会好得多。有人愿意分享改进建议吗?为我指明正确的方向,剩下的事情我来做。请在下面找到粘贴的代码。

#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
4

1 回答 1

0

您可以将命令连接在一起

获取内容 | Foreach 行运行复制项

RoboCopy 清理

Get-Content "C:\powershell\Dragonlog\Log Grab\sept915920.txt" | Copy-Item \\$_\c$\Users C:\dgnlogs\top50915920\$_ -filter dragon.log -Recurse
robocopy C:\dgnlogs\top50915920 C:\splunkdragonlogs\top50915920 /s /move
于 2017-09-20T15:04:09.707 回答