I am new to Powershell and I have a question.
$status = @(qlist job -jt backup -co s)
Write-Host $status[3]
$status[3] -ceq "Suspended"
The answer is
Suspended
False
My question is: Why is this comparison false?
Looks like you have an extra space in $status[3]
" Suspended" -eq "Suspended"
False
you may try:
" Suspended" -like "*Suspended*"
True
Parameter -ceq means case sensitive equal, so use only if really needed.
Equivalent for case sensitivity like is -clike
P.S. Also another option would be to use the trim method, which will remove the empty spaces: $status[3].trim() -eq "Suspended"