Hey Guys :smileygrin:
Just wondering, does anyone know how to identify offline disks within Windows via WMI and PowerCLI?
I need both ideally as I want to improve my SCSI ID match to hard disk script.
Right now it does everything I want except provide the status of the disk... the problem is, even when a disk is "offline" it still reads as "Status OK" in WMI. There has to be somekind of key or parameter in WMI that will allow me to determine if the disk is offline or online - this is the last thing I really need for my script for it to be 100% complete.
Thanks all :smileygrin:
not sure if I understand your question correctly, in windows 2012, powershell its cmdlet get-disk should report disk offline or online?
My code has to run remotely, it defeats the purpose if I have to run it locally.
I did check that command your provided and it works perfectly, but unfortunately its unavailable for Windows 7 and Server 2008. It doesnt appear to be remotely executable in that I cannot probe a machine remotely to pull information so this cmdlet isnt great, but at least we have one.
Is there no way to query this using WMI or PowerCLI without explicitly using a commandlet designed for Server 2012?
Don't know of any WMI class that will show this info.
But you can do this (remotely)
Invoke-Command -ComputerName MySrv -ScriptBlock {"list disk" | diskpart}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Admittedly I have seen this code on the Microsoft forums:
Invoke-Command -ComputerName srv1 -ScriptBlock {"list disk" | diskpart | Where {$_ -match "Offline"}}
I was hoping to get around the need to use Invoke-Command
Thanks for the advice guys, i'll keep looking.