Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 and sample.txt contains

SELECT 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?

share|improve this question

3 Answers 3

up vote 3 down vote accepted

Launch DISKPART and run LIST DISK. The status column will show if they're online or not.

share|improve this answer
    
Thanks a tonn . This really solved my problem. –  Vaibhav Sep 11 '12 at 12:05

You can use the following code to get the status of a drive. This is powershell code.

Get-WmiObject -Class win32_diskdrive -Property STATUS
share|improve this answer
    
+1 for single liner –  dunxd Sep 11 '12 at 14:49

Use WMIC: WMIC DISKDRIVE GET Availability,Index,Caption

The values for availability can be found in the MSDN.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.