Workstation Uptime > 24 hours Smart Label

Today I set out to create a script that would automatically reboot workstations (not servers) at midnight following 24 hours of uptime. This is to facilitate patching and software deployment. The problem was the syntax for Uptime in the smart label wizard didn't seem to work any way I tried to enter it. With some help from IT Ninja and KACE support this is what I found works. 


For non-server windows based machines.

For Servers it shoud look something like this.

With additional limits on the Workstation Label

With the first smart label and reboot script, we're hoping to have this in place once it's tested and approved. I hope this helps!


  • Great post and thanks for sharing with the community! - erik.ragan 9 years ago
  • On your 2nd query the one for servers. Since you are using NOT RLIKE this will match a string. Since you include "8" in the the regex string this will exclude anything with 2008 in the OS_NAME. ie Server 2008. You might want to double check that. - dugullett 9 years ago
    • It actually works because there is a space in front of each number. This way the query will miss 2008 because of the zero in front of the eight. I just checked into the label and there are Server 2k8 entries showing up. - GeekSoldier 9 years ago
      • Ah... I see that now. Maybe my vision is getting bad. :( - dugullett 9 years ago
  • No problem, you can adjust the amount of uptime to fit your needs/requirements. 24 hours was the example I used because I'd ideally leave this sit for a day or two to allow updates to take place. Then I'd disable it until needed again. I hope you find it useful. - GeekSoldier 9 years ago
  • I just did the same thing by combining a Smart Label that pulled all machines with greater than X days Uptime, and an LDAP label targeting only user workstations (for example) and combined those into one master label and assigned that to a nightly reboot script. So any machine in my Workstation OU that goes over X days of uptime will reboot at 2am. - Kace_jar08 9 years ago
    • In my organization it is a necessity because we tell our users to reboot daily, but I was seeing workstations with more than 14 days of uptime... Not anymore. - GeekSoldier 9 years ago
This post is locked
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