Cool Clicks, Swift Kicks: Unleash Peak Mac Performance for a Smoother Ride!

As Intune admins, keeping our devices humming along smoothly is a top priority. That means not just security, but also peak performance. One often-forgotten hero in this fight? Strategic reboots! They apply updates, clear out cobwebs, and generally get Macs back on track. But manually clicking "restart" across hundreds of devices? No thanks.

Today, we're ditching the click-fest and taking a ride on the "Cool Clicks, Swift Kicks" train! It's all thanks to a custom Bash script designed specifically for macOS that orchestrates automated reboots. Let's see how to unleash peak Mac performance for a smoother user experience for everyone!


The Challenge of Uptime Management

Uptime, it's a double-edged sword for Intune admins, right? On one hand, a rock-solid system is great, but on the other, those Macs can get bogged down without a refresh. Manually tracking reboots for hundreds of devices is a click-happy nightmare we all want to avoid.

That's where "Cool Clicks, Swift Kicks" comes in! This custom Bash script automates Mac reboots, ensuring optimal performance and adherence to IT policies. It's the one-click solution to keeping your Mac fleet running smoothly, freeing you up for more strategic tasks. Let's dive into the details!

Introducing the Custom Bash Script

Now that we've explored the uptime tightrope walk, let's introduce the solution that eliminates the manual clicking tightrope altogether: the Bash script!

This script is your secret weapon for automating Mac reboots across your entire MDM-managed fleet. It takes the reins on monitoring system uptime and intelligently prompts users when it's time for a refresh. No more endless clicking or worrying about missed updates – just smooth sailing!

Here's what makes script the ultimate reboot maestro:
  • Uptime Sleuth: The script meticulously calculates a Mac's uptime in hours, giving you a clear picture of its operational state. This data becomes the foundation for informed reboot decisions.
  • Smart Notifications: It's not just about calculating uptime; it's about acting on it intelligently. Depending on a device's uptime, the script triggers tailored notifications. Think gentle reminders or a more urgent countdown dialog box – you decide the level of urgency based on your policies.
  • Flexibility Reigns Supreme: MDM admins have the power to customize the script's parameters to fit their specific IT needs. This means setting different uptime thresholds before prompting users for a reboot, ensuring everyone's on the same page about optimal performance.

So, ditch the manual reboot click-a-thon and let automation take the wheel! It's time to unleash peak Mac performance and keep your users productive, all while ensuring top-notch device security thanks to those crucial updates.


Behind the Scenes

Now that you've met the script, let's peek under the hood and see how it orchestrates these automated Mac reboots!

The script operates on a tiered system, taking a user-friendly approach to prompting reboots. Here's how it tailors notifications based on uptime:

  • 1-5 Days: All Quiet on the Reboot Front: For systems that have been up for a short time (1-5 days), the script stays silent. This timeframe is considered normal operational uptime, so no need to nudge the user just yet.
  • 7-10 Days: Gentle Reminders Take Center Stage: As uptime climbs between 7-10 days, daily notifications gently appear. These are friendly reminders for the user to consider a reboot for optimal performance. Think of it as a subtle tap on the shoulder, suggesting it might be time for a refresh.
  • 11-13 Days: Finding the Reboot Sweet Spot: For extended uptime scenarios (11-13 days), the script adopts a balanced approach to notifications. This provides users with the flexibility to choose a reboot window that aligns best with their workflow, minimizing disruption.
  • 15 Days and Beyond: Time for Action! When a Mac surpasses the 15-day uptime mark, the script kicks things up a notch. It triggers a more urgent dialog box with a countdown timer. This is the script's way of strongly suggesting an immediate reboot. After all, prolonged uptime can lead to sluggish performance and missed updates, which can compromise security. This countdown is a clear call to action, ensuring important updates are applied and the system remains healthy.

Deployment and Customization

Deploying this script through your MDM platform is a breeze. You can push it as a custom script, meaning it runs at specific intervals you define. Alternatively, you can configure it to trigger based on specific events, like system startup (by hardcoding in the script). This ensures the script is always on the lookout for optimal reboot times.

Pre-requisites: Ensuring Smooth Deployment

Before diving into the world of automated reboots and streamlined device management, there's a crucial step every MDM admin must undertake: deploying swiftDialog. This tool is the linchpin of our script, enabling it to communicate with users through polished, native macOS notifications and dialog boxes.

Why swiftDialog?

swiftDialog serves as a bridge between our script's logic and the user's experience, offering a customizable and interactive interface that far surpasses standard notification capabilities. Its versatility allows us to craft messages that can't be ignored, ensuring our reboot prompts are both seen and acted upon.

Deploying swiftDialog with MDM:

To integrate swiftDialog into your macOS fleet, you'll deploy it using your MDM solution. While the exact steps will depend on your specific MDM platform, the essence is the same: package swiftDialog as an enterprise app and push it to your devices as a mandatory install with the required configuration. Here is the example, how I am deploying it:

  • Adding swiftDialog as a pkg app:
  • Next part is the most critical part for approving and setting Notification type via MDM. As we are using swiftDialog in the script to send system notifications, so it is important that we allow these settings via Intune. And, to achieve this, I am deploy the below mobileconfig that will pre-approve notifications and set the notification type.
💡
This pre-deployment step is crucial. Without swiftDialog properly installed on the target, the script functionality will fail.
<key>PayloadContent</key>
<array>
    <dict>
        <key>PayloadDisplayName</key>
        <string>Notifications Payload</string>
        <key>PayloadIdentifier</key>
        <string>018e529a-e5ad-70f3-aabc-8bc88f3f1b5e</string>
        <key>PayloadOrganization</key>
        <string>IRL</string>
        <key>PayloadType</key>
        <string>com.apple.notificationsettings</string>
        <key>PayloadUUID</key>
        <string>018e529a-ad64-7e38-bcf5-41dc654b5910</string>
        <key>PayloadVersion</key>
        <integer>1</integer>
        <key>NotificationSettings</key>
        <array>
            <dict>
                <key>AlertType</key>
                <integer>1</integer>
                <key>BadgesEnabled</key>
                <true/>
                <key>BundleIdentifier</key>
                <string>au.bartreardon.dialog</string>
                <key>CriticalAlertEnabled</key>
                <true/>
                <key>NotificationsEnabled</key>
                <true/>
                <key>ShowInLockScreen</key>
                <true/>
                <key>ShowInNotificationCenter</key>
                <true/>
                <key>SoundsEnabled</key>
                <true/>
            </dict>
            <dict>
                <key>AlertType</key>
                <integer>1</integer>
                <key>BadgesEnabled</key>
                <true/>
                <key>BundleIdentifier</key>
                <string>au.csiro.dialog</string>
                <key>CriticalAlertEnabled</key>
                <true/>
                <key>NotificationsEnabled</key>
                <true/>
                <key>ShowInLockScreen</key>
                <true/>
                <key>ShowInNotificationCenter</key>
                <true/>
                <key>SoundsEnabled</key>
                <true/>
            </dict>
        </array>
    </dict>
</array>
  • Once, this is deployed, then it is the time to push the script to automate reboots.
  • Deploy the script as a shell script for your macOS devices:

Customization is Key

One of the script's biggest strengths is its adaptability. This gives you, the MDM admin, the power to tailor it perfectly to your organization's needs. Here are some ways you can customize the script:

  • Fine-Tune Notifications: Tweak the notification messages to match your desired tone and information level. Do you prefer a gentle nudge or a more urgent message? The choice is yours!
  • Set Uptime Thresholds: Adjust the uptime thresholds that trigger notifications. Do you want daily reminders after 7 days, or perhaps a more aggressive approach? You have complete control!
  • Alert Sounds That Match Your Style: Even the alert sounds are customizable! Choose a sound that best aligns with your notification style, ensuring it's both informative and non-intrusive.

By leveraging the script's customizability, you can create a reboot management system that perfectly complements your existing policies and user preferences.


Why Not Use Nudge for macOS?

While the script offers a custom script solution, you might be wondering about Nudge for macOS, a popular tool for encouraging Mac updates. Nudge is a great option, and it does boast some fantastic features. However, here's why a custom script might be the better fit for some organizations:

  • The Open-Source Conundrum:

Nudge excels in functionality. However, being open-source software can raise a red flag for some enterprises. Many organizations have strict policies against using open-source tools or software hosted on public repositories. This can stem from security concerns or a desire for a more controlled environment.

  • Tailored for Your Needs

A custom script, offers an alternative path. It provides the flexibility to tailor notifications, uptime thresholds, and even alert sounds to your organization's specific needs and policies. This level of customization isn't readily available with Nudge.

  • The Choice is Yours:

Both Nudge and custom scripts offer effective ways to manage Mac reboots. Ultimately, the best choice depends on your organization's unique requirements and security policies. If you prioritize a controlled environment and need complete customization, custom scripts might be the perfect solution for you!


Conclusion

There you have it! I hope this post offers a powerful and versatile solution for automated Mac reboots in your enterprise. It streamlines your workflow, empowers users with control, and ensures optimal system health – all while freeing you up for more strategic tasks.

So ditch the manual click-a-thon and embrace the future of automated Mac reboots! Make your life easier and your Macs happier (and faster!).

💡
The script can be downloaded from:
macOS/Shell Scripts/schedule_reboot.sh at main · pathaksomesh06/macOS
macOS. Contribute to pathaksomesh06/macOS development by creating an account on GitHub.