Added $Parallel switch

This commit is contained in:
dfrancis-adm
2019-04-26 12:03:39 -04:00
parent 27b54aef4e
commit a0d02f56ed

View File

@@ -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
if (!$Parallel){
Install-BoxstarterPackage -ComputerName $ComputerName -PackageName $ScriptPath
}
else {
#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
# }
$ComputerName | ForEach-Object {
start-process -RedirectStandardOutput C:\Windows\Temp\$_.txt -FilePath powershell -ArgumentList "-windowstyle hidden Install-BoxstarterPackage -ComputerName $_ -PackageName $ScriptPath" -PassThru
}
}
}