showdisk - monitor disk usage on a list of computers

The script gathers information on hard disk usage from a list of servers. Disks with less than 20 % free space are highlighted - yellow for 10-20 % and red for <10 %

5 Star
Add to favorites
E-mail Twitter Digg Facebook
  • Regex expressions doesn't filter result correctly
    5 Posts | Last post August 15, 2010
    • I believe the regex expressions in here don't filter as required.  The output contains a decimal point and the regex expression is not filtering for it.
      I can get a partial match by using "^1[0-9]|.\d*[0-9]," but I'm a hack at this and I'm not sure I am right either.
      Can anyone else shed some light on this?
    • I found what was causing my issue.
      For whatever reason, Jens powershell formats decimals as commas.  I replaced the comma on the end of the expression with "\." so it looks like this now and it works for me.
      colorize-row -prop "free(%)" -regex "^5[0-9]\." | `
      colorize-row -prop "free(%)" -color "yellow" -regex "^2[0-9]\.. \%$" | ft
    • A corrected version below - I had added other values in for testing purposes.
      colorize-row -prop "free(%)" -regex "^[0-9]\." | `
      colorize-row -prop "free(%)" -color "yellow" -regex "^1[0-9]\.. \%$" | ft
    • The two regexes for colorization are indeed using a comma as a decimal separator. If you want to have the flexibility to run the script on machines configured either with "." or "," as a decimal separator, change the regexes like this:
      -regex "^[0-9](,|\.)"
      -regex "^1[0-9](,|\.). \%$"
    • Just to make one thing clear: The comma is used as the standard decimal separator in quite a few countries, including Germany. So Jens just forgot that it might be different in countries like the UK or USA :-)