use new funcs in Tools.ps1
This commit is contained in:
+6
-14
@@ -1,5 +1,5 @@
|
||||
# Check the RMM runtime variable to see if it's set to 'null', if not then set the $TicketID
|
||||
If ( $TicketNumber.Trim().ToLower() -ne 'null' ) { Import-Module $env:SyncroModule -WarningAction SilentlyContinue ; $TicketID = $TicketNumber.Trim() }
|
||||
If ( $TicketNumber.Trim().ToLower() -ne 'null' ) { $Global:TicketNumber = $TicketNumber.Trim() }
|
||||
|
||||
# Run SFC to check the filesystem, convert the result from Unicode to UTF8, delete the intermediate $tempFile
|
||||
$tempFile = New-TemporaryFile
|
||||
@@ -10,7 +10,7 @@ $TicketComment = "SFC Output:`n"
|
||||
ForEach ( $line in $SFCOutput ) {
|
||||
If ( $line -notmatch 'Verification \d{1,2}% complete' ) { $TicketComment = $TicketComment + $line + "`n" }
|
||||
}
|
||||
If ( $TicketID ) { Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $true -DoNotEmail $true }
|
||||
New-TicketComment -Comment $TicketComment -Hidden -DoNotEmail
|
||||
Remove-Item $tempFile -Force -ErrorAction SilentlyContinue
|
||||
|
||||
# Examine $SFCOutput for integrity violations, if found make sure chkdsk runs at the next boot
|
||||
@@ -47,17 +47,9 @@ Else { Write-Output "Online image cleanup and restoration is only supported on W
|
||||
If ( $ScheduleCheckDisk ) {
|
||||
Write-Output "Scheduling disk repair at next boot"
|
||||
Start-Process "cmd.exe" -ArgumentList '/C echo y | chkdsk /F /R /X' -Wait
|
||||
If ( $TicketID ) {
|
||||
$TicketComment = "Scheduled disk repair at next boot"
|
||||
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $true -DoNotEmail $true
|
||||
$TicketComment = "I've made some changes that will require you to restart your computer.`n`nWhenver you're ready, please restart your computer and allow it 30min to complete the startup process."
|
||||
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $false -DoNotEmail $false
|
||||
}
|
||||
New-TicketComment -Comment "Scheduled disk repair at next boot" -Hidden -DoNotEmail
|
||||
New-TicketComment -Comment "I've made some changes that will require you to restart your computer.`n`nWhenver you're ready, please restart your computer and allow it 30min to complete the startup process."
|
||||
} Else {
|
||||
If ( $TicketID ) {
|
||||
$TicketComment = "Disk check was not scheduled to run, as no Windows integrity violations were found."
|
||||
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $true -DoNotEmail $true
|
||||
$TicketComment = "Your computer has been repaired. Please restart as soon as you're able."
|
||||
Create-Syncro-Ticket-Comment -TicketIdOrNumber $TicketID -Subject "Update" -Body $TicketComment -Hidden $false -DoNotEmail $false
|
||||
}
|
||||
New-TicketComment -Comment "Disk check was not scheduled to run, as no Windows integrity violations were found." -Hidden -DoNotEmail
|
||||
New-TicketComment -Comment "Your computer has been repaired. Please restart as soon as you're able."
|
||||
}
|
||||
Reference in New Issue
Block a user