command line for getting information about status of disk?
11,289
Solution 1
Launch DISKPART
and run LIST DISK
. The status column will show if they're online or not.
Solution 2
You can use the following code to get the status of a drive. This is powershell code.
Get-WmiObject -Class win32_diskdrive -Property STATUS
Solution 3
Use WMIC: WMIC DISKDRIVE GET Availability,Index,Caption
The values for availability can be found in the MSDN.
Related videos on Youtube
Comments
-
Vaibhav over 1 year
Here is the scenario, I have Windows Server 2003 and 2008 which is connected LUNs. I wanted to get status of the disk if disks are online or offline using command line.
I'm trying to execute
diskpart /s sample.txt
andsample.txt
containsSELECT DISK=1 CREATE PARTITION primary
So, the above command is not getting executed , because the disk is offline. Is there any native "command line utility" or script to check the status of LUNs assigned to system?
-
dunxd over 11 years+1 for single liner
-
kasperd about 8 yearsThis answer needs explanation.
-
HBruijn about 8 yearsWelcome to Server Fault! It looks like you may have the knowledge to provide good Answer here, but please consider reading How do I write a good Answer? in our help center and then revise the Answer. Your Commands/Code/Settings may technically be the solution but some explanation is welcome. Also please use Markdown and/or the formatting options in the edit menu to properly type-set your posts to improve their readability, convention is to mark command/scripts/code as
code
. Thanks in advance.