I am currently using a PowerShell script to read the output of a file and then if the number is higher than I want, it sends an email. Script is below -
$Ou
if you check out get-member on $Queued by running $Queued | gm you will see this: TypeName: System.String
so $Queued is a string and thus -gt does not work. however if you cast the the variable as integer as follows (the [int] tells the variable to be an integer) you can use -gt as shown in your example:
[int]$Queued = (Select-String -Path $Output -Pattern '(?<=Queued:\s+)\d+').Matches.Value
running $Queued | gm now will show you this: TypeName: System.Int32