• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
ControlUp Community

ControlUp Community

Connect, Learn, and Grow

  • Blog
  • Podcast
  • Meetups
  • Archives
  • Categories
    • ControlUp One Platform
    • ControlUp for Apps
    • ControlUp for Compliance
    • ControlUp for Desktops
    • ControlUp Scripts & Triggers
    • ControlUp Synthetic Monitoring
    • ControlUp for VDI
  • Topics
  • Events
    • Logos & Wallpaper
    • ControlUp.com
  • Join

Configuring ControlUp for Automatic Reboot and Maintenance Mode Removal

Posted on November 30, 2023

This discussion covers how to configure ControlUp to restart a server with the CU Agent when no users are on, including removing it from maintenance mode after reboot. Suggested actions include using a trigger that checks for session count and maintenance mode, and separate scripts for Reboot and Disable Maintenance mode. The benefits of using this method compared to scripts are explained.


Read the entire ‘Configuring ControlUp for Automatic Reboot and Maintenance Mode Removal’ thread below:

Is there a way to modify the "Restart computer with CU Agent" script so that it only executes where there are 0 users on the server?


I’m sure it can be done but what are you trying to ultimately do?

Are you wanting to run this on a trigger?


Yes. We’ve done this. There’s something in general purpose servers display that will show you how many people are logged on. You can then specify this in a trigger. We do it to put machines into maintenance mode when there’s no users online


☝️Thats exactly why I ask…

The problem if you don’t do it this way, the trigger will fire, run the script, check that a user is on and quit. The trigger would never refire depending on what the original trigger was.


I’ll take a look at ours and see what we did


Yes – we want this to run on a machine where we bleed users off a server that is in maintenance mode

Basically we have an Event Log trigger that when it hits, it performs the following:

  1. places server into Maintenance Mode
  2. logs off disconnected users

We want the third action to be reboot the server when no users are left on it


That would need to be broken up into a couple triggers/actions.

The final reboot one could be something like If XD Maintencance Mode = True and User Sessions = 0 and uptime > 1 hour then reboot machine with cuagent.


Thanks!

Would there be a way to take it out of maintenance after automatically?


Is that something you would really want to automate? Like what if you need to keep it in maintenance mode?


Basically we would want to place the server back into production after the reboot

But true – it is something we can do manually


Why does it need to be a separate trigger/script?

I have a script process that when launched via management system:

  1. Creates a HyperV Checkpoint
  2. Puts server in Citrix Maintenance mode.
  3. Puts server in monitoring downtime mode (no alerts)
  4. (Does not log out disconnected sessions, but I am now thinking of adding that)
  5. Monitors sessions until there are no users logged in.
  6. Disables maintenance mode.
  7. Reboots the server.

Could you base this off the "User Logged Off" trigger? The checks would then be on session count and in-maintenance-mode.


@member The concern I would have is that the script has to sit in a loop while waiting for the server to clear, and that a script is relatively opaque compared to configurations that are easy to see for anyone else on your team. Separating it into individual triggers for each step will reduce load, get rid of the risk of something interrupting the script, and make it easier for someone else to validate what it’s supposed to do on your team (I’m remembering GPO vs. script design decisions in various customer environments from my consulting days- GPO was always the cleaner option because we could identify everything that was happening much more quickly if there was an issue).

I’d probably put the first 4 steps into a single script, then use a trigger to do the fifth and fire off a script (or a pair of them) to reboot and disable maintenance mode.

Continue reading and comment on the thread ‘Configuring ControlUp for Automatic Reboot and Maintenance Mode Removal’.  Not a member? Join Here!


Categories: All Archives, ControlUp for Desktops, ControlUp Scripts & Triggers
Topics: Automation & Alerting, Citrix, ControlUp Agent, Logs, Scripts, Triggers

Ask Us Anything, Connect, Learn, and Grow with the ControlUp Community!

Login to the ControlUp Community to ask us anything, stay up-to-date on what’s new and coming soon and meet other like-minded techies like you.

Not already a member? Join Today!

Primary Sidebar

ControlUp Academy

Enroll in ControlUp Academy for expert-led technical training, equipping you with skills to effectively deploy, manage, and grow your ControlUp investment.

Learn here >

Rotating Images

Hidden Gem from our Community on Slack!

ControlUp Betas - What's Coming Next?
NEW ControlUp Features - Stay Up-to-Date!
ControlUp Scripts - Scripting, Zero to Hero
Latest KB Articles - Be the First to Learn
Did you Know - with Sivan Kroitoru
Practical Perspectives Technical Use Case Training

Video Tutorials Library

Visit our technical how-to videos, offering step-by-step tutorials on advanced features, troubleshooting, and best practices.

Watch here >

ControlUp Blog

Check out the ControlUp blog for expert advice and in-depth analysis.

Read here >

ControlUp Script Library

Visit the ControlUp technical script library, which offers a multitude of pre-built scripts and custom actions for your monitoring and troubleshooting requirements.

See here >

ControlUp Support

Visit the ControlUp support home and to delve deeper into ControlUp solutions.

Browse here >

Download ControlUp RealTime DX

Start with ControlUp for real-time end-user environment insights, swift troubleshooting, and unprecedented performance optimization. Download now.

Download here >

Footer

      

ControlUp Community
Of Techie, By Techie, For Techie!

Terms of Use | Privacy Policy | Security
Dive Deeper, Learn more at ControlUp.com

  • facebook
  • twitter
  • youtube
  • linkedin

© 2023–2025 ControlUp Technologies LTD, All Rights Reserved.

We use cookies to ensure that we give you the best experience on our website. by continuing to use this site you agree to our Cookie policy..