-1
如何在多臺計算機上並行運行PowerShell腳本?並行運行powershell命令
$TempFolder = "C:\DOWNLOADED_APPLICATIONS"
if(!(test-path $TempFolder))
{New-Item -path $TempFolder -type directory}
Write-Host ""
Write-Host "Downloading .NET framework v4.0 installation package" -ForegroundColor Yellow;
$src = "\\onesoul\tools\DOTNET45\dotNetFx45_Full_x86_x64.exe"
$dest = "$TempFolder" + "\" + "dotNetFx45_Full_x86_x64.exe"
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($src, $dest)
$args = " /q /norestart"
Write-Host "Installing .NET framework v4.0" -ForegroundColor Yellow;
Start-Process -FilePath $dest -ArgumentList $args -Wait
Write-Output "Dot net 4.5 installed"
如果我一次在一臺計算機上遠程運行它,該腳本可以正常工作。我如何讓它平行運行?
您可以使用[jobs](http://stackoverflow.com/a/18193195/1630171)。 –
根據您的環境,您最好只做一次下載,然後將其複製到其他機器,並使用invoke-command啓動每個機器上的安裝。 – mjolinor