How to use power shell to exctract values from command output


hello,
i'm trying adaptec raid array status using arcconf cli and  powershell monitoring
can not figure out way last values 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 the  "0" value  command output.


please help.

 

try this:

(.\arcconf.exe getconfig 1 | select-string -pattern "defunct disk drive count").tostring().split(":")[1] 



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

some help on Event 540

WMI Repository 4GB limit - Win 2003 Ent Question

Event ID 1302 (error 1307) DFS replication service encountered an error while writing to the debug log file