Rounding without CurrencyGroupSeparator
I posted this as a comment at first but I guess the possibility isn't immediately obvious so having an answer here may be useful.
{0:Nx}
turns number into a string which can be cast back to any suitable numeric type. Since you want to preserve decimals:
[decimal]('{0:N5}' -f ($AvgObjDiskReadQueueValues.average))
is what you want.
To make this solution culture-independent you can use a little trick:
$OldCulture = [System.Threading.Thread]::CurrentThread.CurrentCulture[System.Threading.Thread]::CurrentThread.CurrentCulture = "en-US"# Do culture-sensitive stuff here. # (As long as it doesn't execute in a different thread.)[decimal]('{0:N5}' -f ($AvgObjDiskReadQueueValues.average))[System.Threading.Thread]::CurrentThread.CurrentCulture = $OldCulture
I solved it with this$Separator = (Get-Culture).NumberFormat.CurrencyGroupSeparator$DiskStruct.AvgDiskSecReadValue = ('{0:N5}' -f ([math]::Round(($AvgObjDiskSecReadValues.average * 1000), 5))).replace("$Separator",'')
By first asking the separator and then replacing it with nothing I get what I want. Changed it back to Alexander's solutions, as it seems cleaner.