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...

O1UrvD.jpeg

82WE1T.jpeg

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



Answer Summary:
Cancel
1 Comment   [ + ] Show Comment

Comments

  • You can start to play with PowerShell JOBS...
    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
    • Thanks, I will save that url for the future :-)
Please log in to comment

Answer Chosen by the Author

1

I found the real cause for this problem and it's discussed here:

https://support.software.dell.com/k2000-systems-deployment-appliance/kb/185562

Answered 01/22/2016 by: szo850
Purple Belt

Please log in to comment

Answers

1
You want to do a restart on the nuke the app command, the delete of the apps does not apply till a reboot on a lot of the  apps because they are in memory.  If you do not want to reboot use the ksleep command to cause a delay.








Answered 01/20/2016 by: SMal.tmcc
Red Belt

  • 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...
  • 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.
Please log in to comment
Answer this question or Comment on this question for clarity
Admin Script Editor
Admin Script Editor is an integrated scripting environment available free here at ITNinja

Share