Created
September 21, 2023 22:52
-
-
Save dudefoxlive/c841c5ed868c0433c9ed632cd8a9614a to your computer and use it in GitHub Desktop.
Simple Powershell script that gets the uptime as it would display in task manager. If the uptime is greater than 14 days it exits with error code 1. If the uptime is less then 14 days it exits with error code 0. If the Uptime is greater than 14 days it triggers the second powershell script to create a notification letting the user know its been …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.DESCRIPTION This script is to check how long the system has been running for and report back to the RMM console. | |
.USAGE This is to be ran from an RMM Solution. This is to provide no user consent. | |
.AUTHOR Dudefoxlive | |
.LASTUPDATED 1/13/2023 at 11:26 | |
.CREATEDATE 1/13/2023 at 11:26 | |
#> | |
$os = Get-WmiObject -Namespace 'root\cimv2' -Class 'win32_OperatingSystem' | |
$LastBoot = $os.converttodatetime($os.lastbootuptime) | |
$days = ((get-date)-$lastboot).Days | |
function Get-SystemUptime | |
{ | |
if ($days -ge 14) { | |
Write-Host System has been online for $days days which is more than 14 days. | |
exit 1 | |
} else { | |
Write-Host System has been online for $days days which is less than 14 days. | |
exit 0 | |
} | |
} | |
Get-SystemUptime |
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# *************************************************************************** | |
# Part to fill | |
# *************************************************************************** | |
# Choose GIF or Base64 | |
$Header_type = "Base64" | |
$URL = "https://raw.githubusercontent.com/damienvanrobaeys/Intune-Proactive-Remediation-scripts/main/Reboot%20warning/reboot.gif" | |
# Toast header in Base 64 format |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment