Post-Installation task wait issues (K2000)
I'm having issues with a post-installation task that Kace doesn't wait for to complete properly, it begins the next task that fails.
Some screenies below, first one in the begining, the other one shows the powershell window still being active and running a scripts, while Kace tries to install BGInfo which is the next task...
The details of the task that is causing the issue below:
Type: Application (the 2 files below zipped together)
Parameter: Remove-AllProvisionedAppxPackage.cmd
Content of cmd: Start /wait Powershell.exe -NoProfile -ExecutionPolicy ByPass -file Remove-AllProvisionedAppxPackage.ps1
Content of Remove-AllProvisionedAppxPackage.ps1: Get-appxprovisionedpackage –online | remove-appxprovisionedpackage –online
I've tried without "start /wait". I've tried running this with the command as a parameter instead, no difference. Please help me out.
Rgrds,
Simon
Answers (2)
Comments:
-
I'm only deleting provisioned apps from the image, not current user, no need for reboot. I can't get it to work properly with start /wait as you have above. Anyways, I've added "ksleep 60" so now it works (even though the script is executed twice for some strange reason. The second time it executes I get a UAC error, but because of the ksleep, the first script is allowed to finish. Wow... - szo850 8 years ago
-
When I run this powershell command as a BAT, it seems like some kind of character issue. It didnt say ...-Online. It said something like ...ÖoÖnline. That why powershell commands always fails for me when running them as BAT I guess. - szo850 8 years ago
Top Answer
I found the real cause for this problem and it's discussed here:
https://support.software.dell.com/k2000-systems-deployment-appliance/kb/185562
You create a Job in the first script and you fire it.
In the second script you check and wait for that job...
It's better than wait a certain amount of time.
It's perhaps a bit more complex but in my opinion possibly more robust.
http://www.howtogeek.com/138856/geek-school-learn-how-to-use-jobs-in-powershell/
Kind regards,
Marco - StockTrader - StockTrader 8 years ago