I have a script that's running a command, producing output, analyzing that output and if it finds the word Queued followed by a number greater than 100 it sends me an email. There are a lot of spaces after queued but I believe my code is correct to accommodate for those. Currently I am only receiving an email when the number is set to 0. Any other number set by -gt or -ge is not notifying me when it should.
Script -
$Output = 'D:\alec.data\QueuedJobs.txt'
d:
set-location -Path 'D:\program files\veritas\netbackup\bin\admincmd'
.\bpdbjobs -summary -L > $Output
[int]$Queued = (Select-String -Path $Output -Pattern '(?<=Queued:\s+)\d+').Matches.Value
if ($Queued -ge 100)
This is the output it's analyzing - Summary of jobs on usclwnbma01
Queued: 130
Waiting-to-Retry: 0
Active: 124
Successful: 26913
Partially Successful: 114
Failed: 186
Incomplete: 0
Suspended: 0
Total: 27337