0

I'm trying to get Adaptec raid array status by using arcconf cli and power shell for monitoring. Can not figure out the way to get the last values from the command returned string in power shell.

PS C:\adaptec\msm\cmdline> .\arcconf.exe  getconfig  1  | select-string   -pattern "Defunct disk drive count"

   Defunct disk drive count                 : 0

I need to get the 0 value from command output.

Paolo Casciello
  • 7,982
  • 1
  • 43
  • 42

2 Answers2

0

split the result at the caracter ':' and take the second part. Something like

((.\arcconf.exe getconfig 1 | select-string -pattern "Defunct disk drive count") -split ':')[1]
Loïc MICHEL
  • 24,935
  • 9
  • 74
  • 103
0

Try this:

(.\arcconf.exe getconfig 1) -match 'defunct disk drive count\s+:\s+(\d+)'
$matches[1]
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328