Running powershell script from within another powershell script


I am trying to update a SharePoint site, which involves running serveral powershell scripts. Some of these scripts spawn another process using the following line. However, the process doesn't seem to be working properly and ends rather quickly and of course does not do what it is supposed to. (If the script is run on its own, it works). Can anybody tell me how to get this process to spawn properly?

-------------------------------------start code section---------------------------------------------------------------------------

 Start-Process powershell.exe -ArgumentList ".\01-BJCBlogs-SyncRunner.ps1 -targetURL '$url' -backupFileLocation '$backupFile' -clientName '$name' -        siteName '$targetSiteName'" -WindowStyle Minimized

    Start-Sleep 10
    $counter ++
    if($counter -gt 2)
  Start-Sleep 1800
  $counter = 0

----------------------------------End code section-------------------------------------------------------------------------------



July 28th, 2015 11:31am

Hi Sherazad,

As this question is more relate to the use of PowerShell script, I suggest you post it to the corresponding forum, you will get more help and confirmed answers there.

The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.   


Patrick Liang

Free Windows Admin Tool Kit Click here and download it now
July 29th, 2015 3:04am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics