/build/static/layout/Breadcrumb_cap_w.png

How do I add 'if restart/log off:continue script''

Hi I am combing two scripts; one that removes local admin from the logged in user, then run ksleep for 10 minutes, then run the script that removes admin from local user. The problem is; if the user restarts at any time during the script, it breaks:

VLcfiQ.jpeg
The idea is to grant admin for around 1.5 hours for short installs and 4 hours for installations of our software using ksleep between the two scripts. But as I mention, if there is a log off/reboot anywhere during the job it fails.

Thanks for any help.

0 Comments   [ + ] Show comments

Answers (1)

Posted by: SMal.tmcc 7 years ago
Red Belt
0
I commented on your other question also.  Create a batch file that runs the remove rights portion and add that as a dependency.  Use Schtasks,exe to make a one time task that runs that batch file at the time you want.  The down side is you will need to modify the line that creates the scheduled task to set the time properly each time you use it.

https://msdn.microsoft.com/en-us/library/windows/desktop/bb736357(v=vs.85).aspx

to point the task to the batch file in the kace directories for the /TR taskrun switch

point at your kscript you made from the script page point to get the id.


then modify that script line that creates the scheduled task to include that id path
/TR C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\416\remove.bat
 
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