Compare commits

...
2 Commits
Author SHA1 Message Date
dyoder 298b8ef050 exit early if the BSOD report is empty 2024-07-18 15:42:41 -04:00
dyoder 2885d975f4 added func Get-StringHash 2024-07-15 13:30:29 -04:00
2 changed files with 15 additions and 0 deletions
+7
View File
@@ -17,6 +17,13 @@ For ($i = 0; $i -lt 1200; $i++) {
# Exit if the BSOD report was not created
If ( !(Test-Path $BSODReport) ) { Write-Output "BSOD report was not found: ${BSODReport}" ; Return }
# Exit if the BSOD report is empty
If ( (Get-Content -Path $BSODReport).Length -eq 0 ) {
Write-Output "BSOD report is empty: ${BSODReport}"
Remove-Item $BSODReport -Force
Return
}
# Create ticket
$BSODReportContent = $(Get-Content -Path $BSODReport) -join "`n"
New-RMMTicket -Subject "System Crash on ${Env:COMPUTERNAME}" -InitialIssue $BSODReportContent
+8
View File
@@ -1106,6 +1106,14 @@ Function New-TicketTimerEntry () {
Create-Syncro-Ticket-TimerEntry -TicketIdOrNumber $TicketID -StartTime $StartAt -DurationMinutes $BillableMinutes -Notes $Comment -UserIdOrEmail $BillableUser -ChargeTime $ChargeTime
}
# Function to get the SHA256 hash of a string
Function Get-StringHash() {
param([Parameter(Mandatory=$true,ValueFromPipeline=$true)][string]$String)
$stream = [IO.MemoryStream]::new([byte[]][char[]]$String)
$hashObj = Get-FileHash -InputStream $stream -Algorithm SHA256
$hashObj.Hash
}
# Initial setup of the MSP management directories and log file
Setup-MSPDirectories
Setup-LogFile