Hi,
It seems the logic is correct. Since the current method doesn't work, we may considering just passing the result and comparing this in the criteria.
In the powershell, just pass the result.
$Result = "{0:N2}" -f ((Get-ChildItem -path $FolderPath -recurse | Measure-Object -property length -sum ).sum /1GB)
$bag.AddValue('Result',$Result)
$bag
Here's some screenshots from the lab, for your reference.
enter the script (if Linux computer, just provide the script path that already created in Linux)
scom_ps_script_based_monitor_03.PNG
configure the criteria (compare the current value with the threshold)
scom_ps_script_based_monitor_04.PNG
map health status
scom_ps_script_based_monitor_06.PNG
enable alerting and write the alert description if necessary
scom_ps_script_based_monitor_07.PNG
Hope the above information helps.
Alex
If the response is helpful, please click "Accept Answer" and upvote it.