Intune script that will check the uptime of each machine in the organization and restart laptop after checks

Christos Christopoulos 20 Reputation points
2024-10-23T10:24:26.2633333+00:00

Hello everyone,

I need your help, please, because I’m feeling desperate. I want to create a detection and a remediation script in Intune. As a result, I would like it to check if the uptime of each machine reaches 5 days and send a warning to the user: “Your PC has been on for 5 days, please restart.” On the 6th day, the warning will say: “Save your work because in 10 minutes your PC will restart,” and then the PC will automatically restart (force restart).

Τhank you

Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
5,165 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,565 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Pavel yannara Mirochnitchenko 12,591 Reputation points MVP
    2024-10-30T11:12:29.3733333+00:00

    If you specificly want to restart computers each 6 days, I would seach and investigate how to do a Task with Task Scheduler using powershell and how to add the message system to it.

    Another consideration is, may I ask why you want to do this? Could the reason be a Fast Start up still turned on by default. Just thinking, are you aware of this?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.