Additional Script Updates
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
$antivirusStatus = Get-MpComputerStatus
|
||||
if ($antivirusStatus.AntivirusEnabled -eq $false) {
|
||||
Write-Output "Antivirus is disabled"
|
||||
exit 1
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
# Define the toast notification content
|
||||
$Group = "Security Alerts"
|
||||
$Title = "Antivirus Disabled"
|
||||
$Message = "Your antivirus is currently disabled. Please enable it to protect your system from threats."
|
||||
|
||||
# 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)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
$batteryStatus = Get-WmiObject -Query "Select * from Win32_Battery"
|
||||
if ($batteryStatus.EstimatedChargeRemaining -lt 25) {
|
||||
Write-Output "Battery health warning"
|
||||
exit 1
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Define the toast notification content
|
||||
$Group = "Battery Alerts"
|
||||
$Title = "Battery Health Warning"
|
||||
$Message = "Your battery health is below 50%. Consider replacing it to avoid unexpected shutdowns."
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,2 @@
|
||||
# Detection script
|
||||
exit 1
|
||||
@@ -0,0 +1,19 @@
|
||||
# Define the toast notification content
|
||||
# Group defines the notification grouping (eg. category). This allows for multiple use cases, which all align within the same group.
|
||||
# Title defines the heading of the Toast Notification.
|
||||
# Message defines the contents of the Toast Notification
|
||||
|
||||
$Group = "This is a Notification!"
|
||||
$Title = "This is the Title!"
|
||||
$Message = "This is the Message!"
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,7 @@
|
||||
$firewallStatus = Get-NetFirewallProfile -Profile Domain,Public,Private
|
||||
if ($firewallStatus.Enabled -contains $false) {
|
||||
Write-Output "Firewall is disabled"
|
||||
exit 1
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Define the toast notification content
|
||||
$Group = "Security Alerts"
|
||||
$Title = "Firewall Disabled"
|
||||
$Message = "Your firewall is currently disabled. Please enable it to protect your system from threats."
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,8 @@
|
||||
$cpuUsage = Get-Counter '\Processor(_Total)\% Processor Time'
|
||||
$averageCpuUsage = [math]::round($cpuUsage.CounterSamples.CookedValue, 2)
|
||||
if ($averageCpuUsage -gt 80) {
|
||||
Write-Output "High CPU usage"
|
||||
exit 1
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Define the toast notification content
|
||||
$Group = "Performance Alerts"
|
||||
$Title = "High CPU Usage"
|
||||
$Message = "Your CPU usage has been consistently high. Consider closing some applications to improve performance."
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,8 @@
|
||||
$memoryUsage = Get-Counter '\Memory\% Committed Bytes In Use'
|
||||
$averageMemoryUsage = [math]::round($memoryUsage.CounterSamples.CookedValue, 2)
|
||||
if ($averageMemoryUsage -gt 80) {
|
||||
Write-Output "High memory usage"
|
||||
exit 1
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Define the toast notification content
|
||||
$Group = "Performance Alerts"
|
||||
$Title = "High Memory Usage"
|
||||
$Message = "Your memory usage has been consistently high. Consider closing some applications to improve performance."
|
||||
|
||||
# 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)
|
||||
@@ -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
|
||||
}
|
||||
@@ -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)
|
||||
@@ -0,0 +1,7 @@
|
||||
$pingResult = Test-Connection -ComputerName google.com -Count 2 -Quiet
|
||||
if (-not $pingResult) {
|
||||
Write-Output "Network connectivity issues"
|
||||
exit 1
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Define the toast notification content
|
||||
$Group = "Network Alerts"
|
||||
$Title = "Network Connectivity Issues"
|
||||
$Message = "Your system is experiencing network connectivity issues. Please check your network connection."
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,7 @@
|
||||
$updates = Get-WindowsUpdate -AcceptAll -IgnoreReboot
|
||||
if ($updates.Count -gt 0) {
|
||||
Write-Output "Pending Windows updates"
|
||||
exit 1
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Define the toast notification content
|
||||
$Group = "Update Alerts"
|
||||
$Title = "Pending Windows Updates"
|
||||
$Message = "There are pending Windows updates. Please install them to keep your system secure and up-to-date."
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,7 @@
|
||||
$printerStatus = Get-Printer | Where-Object { $_.PrinterStatus -ne 'Idle' }
|
||||
if ($printerStatus) {
|
||||
Write-Output "Printer issues detected"
|
||||
exit 1
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Define the toast notification content
|
||||
$Group = "Printer Alerts"
|
||||
$Title = "Printer Issues Detected"
|
||||
$Message = "There are issues with your printer. Please check the printer status and resolve any errors."
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,8 @@
|
||||
$uptime = (Get-CimInstance Win32_OperatingSystem).LastBootUpTime
|
||||
$daysUptime = (Get-Date) - $uptime
|
||||
if ($daysUptime.Days -ge 7) {
|
||||
Write-Output "Reboot required"
|
||||
exit 1
|
||||
} else {
|
||||
exit 0
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
# Define the toast notification content
|
||||
$Group = "System Alerts"
|
||||
$Title = "Reboot Required"
|
||||
$Message = "Your system has been running for over 7 days. Please reboot to ensure optimal performance."
|
||||
|
||||
# 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)
|
||||
@@ -0,0 +1,59 @@
|
||||
## Toast Notifications
|
||||
|
||||
### Get-AntivirusStatus
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-AntivirusStatus)
|
||||
- **Detection**: Checks MpComputerStaus for if Antivirus is Disabled.
|
||||
- **Remediation**: Runs a Security Alert related Toast Notification.
|
||||
|
||||
### Get-BatteryHealthWarning
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-BatteryHealthWarning)
|
||||
- **Detection**: Checks Battery Health for Estimated Charge Remaining.
|
||||
- **Remediation**: Runs a Battery Alert related Toast Notification.
|
||||
|
||||
### Get-CustomToastNotification
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-CustomToastNotification)
|
||||
- **Detection**: An Exit 1, Prompting the Remediation.
|
||||
- **Remediation**: Runs a Toast Notification. Update the Group, Title and Notification in the script and Set the Schedule.
|
||||
|
||||
### Get-FirewallStatus
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-FirewallStatus)
|
||||
- **Detection**: Checks if all Firewall Profiles are currently Enabled, Prompts for Remediation if any are found Disabled.
|
||||
- **Remediation**: Runs a Security Alert related Toast Notification.
|
||||
|
||||
### Get-HighCPUUsage
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-HighCPUUsage)
|
||||
- **Detection**: Checks if the average CPU usage is greater than 80%.
|
||||
- **Remediation**: Runs a Performance Alert related Toast Notification.
|
||||
|
||||
### Get-HighMemoryUsage
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-HighMemoryUsage)
|
||||
- **Detection**: Checks if the average Memory usage is greater than 80%.
|
||||
- **Remediation**: Runs a Performance Alert related Toast Notification.
|
||||
|
||||
### Get-LowDiskSpace
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-LowDiskSpace)
|
||||
- **Detection**: Checks if the C: Drive disk space is less than 10GB.
|
||||
- **Remediation**: Runs a System Alert related Toast Notification.
|
||||
|
||||
|
||||
### Get-NetworkConnectivityIssues
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-NetworkConnectivityIssues)
|
||||
- **Detection**: Checks if google.com receives a ping response.
|
||||
- **Remediation**: Runs a Network Alert related Toast Notification.
|
||||
|
||||
|
||||
### Get-PendingWindowsUpdate
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-PendingWindowsUpdate)
|
||||
- **Detection**: Checks if there is any outstanding Windows Updates pending on the endpoint.
|
||||
- **Remediation**: Runs a Update Alert related Toast Notification.
|
||||
|
||||
|
||||
### Get-PrinterIssues
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-PrinterIssues)
|
||||
- **Detection**: Checks if there is any outstanding printing issues.
|
||||
- **Remediation**: Runs a Printer Alert related Toast Notification.
|
||||
|
||||
### Get-RebootRequired
|
||||
[Link](https://github.com/AntoPorter/Intune-Remediations/tree/main/ToastNotifications/Get-RebootRequired)
|
||||
- **Detection**: Checks the Endpoints last boot up time, If greater than 7 days, prompts for Remediation.
|
||||
- **Remediation**: Runs a System Alert related Toast Notification.
|
||||
Reference in New Issue
Block a user