From dd72c875d340077a4c3990d7eb04403ff4221700 Mon Sep 17 00:00:00 2001 From: silversword411 Date: Tue, 16 Mar 2021 14:13:30 -0400 Subject: [PATCH] Add Bluescreen script From dinger1986 --- .../scripts/community_scripts.json | 7 +++++++ scripts/Check_Events_for_Bluescreens.ps1 | 20 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 scripts/Check_Events_for_Bluescreens.ps1 diff --git a/api/tacticalrmm/scripts/community_scripts.json b/api/tacticalrmm/scripts/community_scripts.json index 9782b09b..c7b51a86 100644 --- a/api/tacticalrmm/scripts/community_scripts.json +++ b/api/tacticalrmm/scripts/community_scripts.json @@ -229,5 +229,12 @@ "name": "AD - Check and Enable AD Recycle Bin", "description": "Only run on Domain Controllers, checks for Active Directory Recycle Bin and enables if not already enabled", "shell": "powershell" + }, + { + "filename": "Check_Events_for_Bluescreens.ps1", + "submittedBy": "https://github.com/dinger1986", + "name": "AD - Check and Enable AD Recycle Bin", + "description": "This will check for Bluescreen events on your system", + "shell": "powershell" } ] diff --git a/scripts/Check_Events_for_Bluescreens.ps1 b/scripts/Check_Events_for_Bluescreens.ps1 new file mode 100644 index 00000000..aaec43c1 --- /dev/null +++ b/scripts/Check_Events_for_Bluescreens.ps1 @@ -0,0 +1,20 @@ +# This will check for Bluescreen events on your system + +$ErrorActionPreference= 'silentlycontinue' +$TimeSpan = (Get-Date) - (New-TimeSpan -Day 1) + +if (Get-WinEvent -FilterHashtable @{LogName='application';ID='1001';ProviderName='Windows Error Reporting';Level=4;Data='BlueScreen';StartTime=$TimeSpan}) + +{ +Write-Output "There has been bluescreen events detected on your system" +Get-WinEvent -FilterHashtable @{LogName='application';ID='1001';ProviderName='Windows Error Reporting';Level=4;Data='BlueScreen';StartTime=$TimeSpan} +exit 1 +} + +{ +else +Write-Output "No bluescreen events detected" +exit 0 +} + +Exit $LASTEXITCODE \ No newline at end of file