I saw a lot of topics about powershell + waiting for process ending, but somehow its not working for me. I have this:
Add-PsSnapin Microsoft.SharePoint.Powershell
Add-SPSolution sol.wsp
Install-SPSolution -identity $sol -GACDeployment
Install-SPFeature "feature"
What Im trying to do is to add a new Sharepoint (2010) solution, then Im trying to install a solution and finally Im trying to install feature.
The last one is failing, because the installation of the solution takes somehow longer but he is already trying to install the feature. I get the error Install-SPFeature : Failed to find the XML file at location if I start the script again the feature can be installed. How could I change my script to handle this problem? Ok sure I could use Start-Sleep -s 2 or something, but thats not the best way. | Out-Null or -Wait isnt working too. I think thats because the process or whatever it is already done, but windows takes some seconds to realize that the solution is installed. Any ideas? Thank you
Did you try to use Start-Job?