I have script some thing like below.
[CmdletBinding()]
param(
[Parameter(Mandatory=$True,Position=1)]
[string]$ConfigurationXml)
if (Test-Path$ConfigurationXml){
[xml]$XMLContent=Get-Content$ConfigurationXml
}
else
{
echo$ ("Configuration file not found"
)
exit 1}
try
{
foreach( $XMLConin$XMLContent.PackageConfiguration.Configuration ) {
$ServiceName=$XMLCon.ServiceName
$ServiceLocation=$XMLCon.ServiceLocation
$ConfigurationFilePath=$XMLCon.ConfigurationFilePath
$PackageFilePath=$XMLCon.PackageFilePath
$AzureStorageAccountName=$XMLCon.AzureStorageAccountName
$SubscriptionName=$XMLCon.SubscriptionName
$MainScriptFileLocation=$XMLCon.MainScriptFileLocation
$PublishFilePath=$XMLCon.PublishFilePath
if ($ServiceName-eq"") {
echo$ ("ServiceName should not be empty");
exit 1}
if ($ServiceLocation-eq"")
{echo$ ("ServiceLocation should not be empty");
exit1}
if ($ConfigurationFilePath-eq"") {
echo$ ("ConfigurationFilePath should not be empty");
exit1}
if ($PackageFilePath-eq"")
{echo$ ("PackageFilePath should not be empty");
exit1}
if ($AzureStorageAccountName-eq"") {
echo$ ("AzureStorageAccountName should not be empty");
exit1
}
if ($AzureStorageAccountName-eq"") {
echo$ ("AzureStorageAccountName should not be empty");
exit1}
if($SubscriptionName-eq"") {
echo$ ("SubscriptionName should not be empty");
exit1}
if($PublishFilePath-eq"")
{echo$ ("PublishFilePath should not be empty");
exit1}
$Command="$MainScriptFileLocation -ServiceName '$ServiceName' -ServiceLocation '$ServiceLocation' -ConfigurationFilePath '$ConfigurationFilePath' -PackageFilePath '$PackageFilePath' -AzureStorageAccountName '$AzureStorageAccountName' -SubscriptionName '$SubscriptionName' -PublishFilePath '$PublishFilePath'"
powershell$Command
} }
catch
{
echo$ ( "Error in executing"+$MainScriptFileLocation+" script."
)
exit1
} where $configurationxml contains details 4 spokes where package to be deployed. when i ran the above script its taking one spoke at a time and deploying the package, after the completion of one its starting the next one. its taking almost 10 min for each spoke and each spoke deployment is independent of other. so here i want to parallelize such that all the spokes starts at a time. i tried foreach-parallel, invoke-parallel, work-flow. but i couldn't reach my goal. you guys have any idea..