我讀過Start-Job作爲一種「多線程」任務的方法的各種資源,但我無法弄清楚如何將變量傳遞給它。我正在使用PowerCLI cmdlet將大公司的存儲從舊陣列遷移到新陣列。他們在美國有7個站點。如何在Powershell中「多線程」存儲遷移腳本?
遷移自動化的想法是/是一個多部分的ps1。 1部分:
Define variables
Import-csv list-of-vms | foreach {
Count the active tasks
While count is at or over threshold, loop.
else
Run site specific ps1 (part 2)
sleep 60
Count
}
第2部分:
if target has move or is queued, exit.
else, move to New-Array
exit
我需要的是從導入-CSV的$ _ VM通關的第2部分腳本的方式...和解釋:)