Additional Script Updates

This commit is contained in:
Andrew Amason
2025-05-19 15:19:36 -04:00
parent ec2b22290a
commit 9c8438d7d1
136 changed files with 1595 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
$freeSpace = (Get-PSDrive -Name C).Free
$freeSpaceGB = [math]::round($freeSpace / 1GB, 2)
if ($freeSpaceGB -lt 10) {
Write-Output "Low disk space"
exit 1
} else {
exit 0
}

View File

@@ -0,0 +1,15 @@
# Define the toast notification content
$Group = "System Alerts"
$Title = "Low Disk Space"
$Message = "Your C: drive is running low on space. Please free up some space to avoid system issues."
# Create the toast notification
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
$template = [Windows.UI.Notifications.ToastTemplateType]::ToastText02
$toastXml = [Windows.UI.Notifications.ToastNotificationManager]::GetTemplateContent($template)
$toastTextElements = $toastXml.GetElementsByTagName("text")
$toastTextElements.Item(0).AppendChild($toastXml.CreateTextNode($Title)) | Out-Null
$toastTextElements.Item(1).AppendChild($toastXml.CreateTextNode($Message)) | Out-Null
$toast = [Windows.UI.Notifications.ToastNotification]::new($toastXml)
$notifier = [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier($Group)
$notifier.Show($toast)