Hi,
I am trying to capture error code in powershell of the diskpart commands that I am firing in my script.
I fire something like this
"select disk' + " $rdisk" + '", "online disk" | diskpart
, where $rdisk comes from any array of disk numbers.
If the disk does not exist then I can read the error message on the STDOUT but $error.count remains 0 [Zero].
How can I capture the error code?