I have published a solution and deployed it.
Add-SPSolution “C:\Users\Admin\Documents\LeaveManagementPortal.wsp" Install-SPSolution –identity "LeaveManagementPortal.wsp" -GACDeployment
This deployed the wsp file and there was a list in it as a feature.
when I try to rollback, the lines below work fine when i execute them one after the other.
stsadm -o retractsolution -name leavemanagementportal.wsp -immediate stsadm -o execadmsvcjobs stsadm -o deletesolution -name leavemanagementportal.wsp
But when I save this as a ps1 file and run it, it throws error
"the solution cannot be removed when a job is scheduled or running"
The first two line run successfully though. Is the third line trying to execute before the timer job is getting completed? how can i solve this?