【发布时间】:2017-11-29 11:43:30
【问题描述】:
在将并行处理代码添加到此脚本时,我可以使用一些帮助。我想我只是对 powershell 的了解还不够,无法理解我在哪里以及在什么地方添加了必要的代码……我正在努力弄清楚,但灯泡还没有亮……:-)
Start-Transcript C:\temp\agent.log -IncludeInvocationHeader
$computers = gc "C:\temp\list.txt"
$source = "\\pathtodfsrootstore"
$dest = "c$\windows\temp\test2533212"
foreach ($computer in $computers) {
foreach (if (Test-Connection -Cn $computer -count 1 -quiet) {
Copy-Item -Force $source -Destination \\$computer\$dest -Recurse
#psexec.exe \\$computer cmd /c "c:\windows\temp\testv2533212\test.bat"
} else {
Write-output "$computer is not online"
}
}
Stop-Transcript
【问题讨论】:
-
下午,也许是重复的,但我希望有人能给我一个帮助,让我开始走上正确的道路......
标签: powershell parallel-processing powershell-4.0