Skip to content

Instantly share code, notes, and snippets.

@Nora-Ballard
Created February 15, 2014 18:52
Show Gist options
  • Select an option

  • Save Nora-Ballard/9023507 to your computer and use it in GitHub Desktop.

Select an option

Save Nora-Ballard/9023507 to your computer and use it in GitHub Desktop.
:: Get Blade Position from WMI, requires HP providers installed.
For /F "delims== tokens=1-2" %%c in ('wmic /namespace:\\root\HPQ Path HP_BladeCSLocation Get PhysicalPosition /format:value^|find "PhysicalPosition=" ') do set PhysicalPosition=%%d
:: C7000 chassis has 16 slots, make sure it is not out of range.
if NOT %PhysicalPosition% gtr 0 IF NOT %PhysicalPosition% lss 17 GOTO Invalid_Bay_Number
:: Pad to 2 digits.
if %PhysicalPosition% lss 10 set PhysicalPosition=0%PhysicalPosition%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment