/build/static/layout/Breadcrumb_cap_w.png

Run script after each boot, but after checkin

We have a group of computers that we need to have run a small .BAT file every time they boot up, but after they are connected to wifi and have checked into the KBOX.  I seem to be hitting a wall.  If I set it to "run at user login," it will run the file before the computer is actually connected to the network.  What would be best is a way to run the script at first checkin after each boot.  Is this even possible?

1 Comment   [ + ] Show comment
  • I appreciate the suggestions, so far. Unfortunately, the fix I need requires that no information can change on the clients, as they will lose those changes on next reboot. So copying a file, changing registry keys, etc. just won't be a viable solution.

    Sorry I wasn't clear about that originally, and I do appreciate the suggestions. - abellante 7 years ago

Answers (3)

Posted by: chucksteel 7 years ago
Red Belt
0
The best approach might be to have the script check if there is an active connection and then check the date on c:\ProgramData\Dell\KACE\inventory.xml. That file is generated when the computer runs an inventory. If the conditions aren't met then the script would sleep and then try again. It would take some coding skill and would probably be easier in PowerShell. 

Another option is to use a scheduled task on Windows. You can configure a scheduled task to require a specific network connection to be available. You can also have a trigger based on an event in the event log. KACE doesn't add anything to the event log but you could either just wait a specific amount of time and assume the inventory ran. Another interesting option would be to create a custom inventory rule that would run a command like this:
eventcreate /ID 1 /L APPLICATION /T INFORMATION /SO KInventory /D "Running KACE Inventory"

That would create an event in the application log which you can use as a trigger for a scheduled task. I'm not sure if you can limit the scheduled task to only run once after the machine is booted, but you could have your script setup to set a marker file and then have a shutdown task that deletes that marker if it is that important.

Posted by: SMal.tmcc 7 years ago
Red Belt
0
create a script that places the command you want to run under the HKCU\software\....\run key.  Then that will run every time after the user logs in by calling that run command key.
Posted by: JC_Chi 6 years ago
Yellow Belt
0
Have you tried a timeout command in your batch file?
https://www.howtogeek.com/196873/how-to-add-a-timeout-or-pause-in-a-batch-file/

You could pause your script from running for 2 mins to allow your pc to connect to the network. 
TIMEOUT delay
 
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