From a0d02f56ed5f7650097615f1eaff8cb0fef76b5f Mon Sep 17 00:00:00 2001 From: dfrancis-adm Date: Fri, 26 Apr 2019 12:03:39 -0400 Subject: [PATCH] Added $Parallel switch --- functions/Invoke-BoxStarterRemoteUpgrade.ps1 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/functions/Invoke-BoxStarterRemoteUpgrade.ps1 b/functions/Invoke-BoxStarterRemoteUpgrade.ps1 index 9195ac9..b46130d 100644 --- a/functions/Invoke-BoxStarterRemoteUpgrade.ps1 +++ b/functions/Invoke-BoxStarterRemoteUpgrade.ps1 @@ -9,6 +9,7 @@ function Invoke-BoxStarterRemoteUpgrade { [string[]]$ExcludedPackages, [Parameter(Mandatory=$true)] [string]$ScriptPath, + [switch]$Parallel ) #Create dynamic upgrade list @@ -39,9 +40,13 @@ function Invoke-BoxStarterRemoteUpgrade { } } #Upgrade computers with Boxstarter - Install-BoxstarterPackage -ComputerName $ComputerName -PackageName $ScriptPath - #Upgrade computers in parallel with Boxstarter - # $ComputerName | ForEach-Object { - # start-process -RedirectStandardOutput C:\scripts\powershell\$_.txt -FilePath powershell -ArgumentList "-windowstyle hidden Install-BoxstarterPackage -ComputerName $_ -PackageName $ScriptPath" -PassThru - # } + if (!$Parallel){ + Install-BoxstarterPackage -ComputerName $ComputerName -PackageName $ScriptPath + } + else { + #Upgrade computers in parallel with Boxstarter + $ComputerName | ForEach-Object { + start-process -RedirectStandardOutput C:\Windows\Temp\$_.txt -FilePath powershell -ArgumentList "-windowstyle hidden Install-BoxstarterPackage -ComputerName $_ -PackageName $ScriptPath" -PassThru + } + } } \ No newline at end of file