Scripting Question

Script always running. It doesn't report "failed" or "completed".

08/31/2016 3225 views
I am trying to use K1000 to push the updated anyconnect "client" and "start before windows" packages to end users in my company. I am doing this with a script that unzips the two MSI and a batch file I created to the client machines. Then kace runs the batch file that silently installs both packages and throws up a warning about the reboot (the MSI for "start before windows" requires a reboot). When I click "run now" everything works fine except the "Run Now Status" for the script doesn't report failed or completed it just shows it as running even though it is completed.

The computers that are off do report a fail when I click "Run Now", but the computers that are on get the software and reboot but report as "running" in kace. Does anyone have any suggestions on how to get the computers to report back? I believe it is because the computer reboot after installing the silent package that wants a reboot. Our kace can connect over the internet, so it isn't because anyconnect is down for the update. Here is the script and batch file I am using.

C:\Users\Public\anyconnect-win-4.3.02039-pre-deploy-k9.msi /qn
echo msgbox "Computer will restart, save your work, then click OK." > "%temp%\popup.vbs"
wscript.exe "%temp%\popup.vbs"
C:\Users\Public\anyconnect-gina-win-4.3.02039-pre-deploy-k9.msi /qn

This is the kace script that call my script:
call C:\Users\Public\setup.bat

Thanks for your help!
Answer Summary:
0 Comments   [ + ] Show comments


Answer Chosen by the Author

I've had this problem too. Like you mentioned, I'm fairly certain it has to do with the computer rebooting. Here is my workaround... I don't know if this is proper, but it works for me. 

Add a New Task
Add a new Verify - check for a file or folder that should exist after install
Add a Remediation - Select "Always Fail" 

What happens is: if the Verify doesn't find the file/folder you specified, then remediation will always fail and it will then show up as Failed in the Run Now Status page. You'll probably need to instruct your msi install to not reboot (with /norestart) and then do the reboot in a separate task after you've verified the install. 

Here is screenshot for reference. 

Answered 09/01/2016 by: getElementById
Third Degree Blue Belt

  • I couldn't paste screenshots into these comments so see my "answer" below please.

All Answers

most likely your msi is doing the restart so the bat never finishes to report completed back to the kbox. 

tell the msi not to restart

C:\Users\Public\anyconnect-gina-win-4.3.02039-pre-deploy-k9.msi /qn /norestart

and add a "on remediation success" to do the restart by issuing.

shutdown /r /t 2
Answered 09/01/2016 by: SMal.tmcc
Red Belt

  • I couldn't paste screenshots into these comments so see my "answer" below please.
This content is currently hidden from public view.
Reason: Removed by member request For more information, visit our FAQ's.
I changed the batch to not restart. It now reports correctly but I can't get it to do the restart I have tried 2 different things without success. First I had a third task to do the restart but it didn't work. Next I tried this:
But it won't do the restart or shutdown. It also seems to run on the laptops that already have the new version installed but I am not sure how exactly to fix that. I am sure you can run a report and see what laptops need the new software and add them to some kind of group or label and put that in my script's Deploy section. I am just very new to this.
Answered 09/02/2016 by: jrenaud
Senior White Belt

  • Yes, use a smart label to get machines that still need the software. For the shutdown/reboot I usually use "shutdown -r -f -t 0". I like instant reboots but you can always change the timeout.
    • I couldn't get it to work. I just changed the params to exactly what you put. I ended up just putting up a message box telling the user to reboot at their earliest convenience. The reboot isn't necessary. The "start before login" function is only used to get the user signed into the domain the FIRST time. After that the credentials are cached and no domain connection is needed to log into windows. If the user sees the KACE popup, their creds are cached.
    • But for future reference, could you post a screen shot of exactly how to enter the reboot command into a kace script please?
  • it may be getting a false error code someplace. to test that change the "on failure" for task 1 to continue instead of break. you may have to add a set errorlevel = 0 in your batch file.
    • I already tried telling it to continue instead of break, that didn't work. I will post my final script as a new answer.
*Post deleted*
I hit submit and got a "page not responding" error so I refreshed and it double posted.
Answered 09/02/2016 by: jrenaud
Senior White Belt

Here is the final script I am going with. I took the reboot warning out of my batch file and got rid of the restart command in the script, I couldn't get it to work. Instead I open a message window telling the user to reboot on their own.

Answered 09/02/2016 by: jrenaud
Senior White Belt

This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ