Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Powershell script to get the Disks that are offline Expand / Collapse
Author
Message
Posted Monday, July 7, 2014 7:43 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: 2 days ago @ 10:27 PM
Points: 219, Visits: 688
Hi I have a scenario where in i need to get disks infomation of 100+ remote servers using powershell script. I have below script which only giving the disk information which are online.

Get-WmiObject win32_logicaldisk -computername MyServerName1,MyServerName2 | Where-Object { $_.DriveType -eq 3 } | Select-Object SystemName,DeviceID,VolumeName,FreeSpace,Size | Export-Csv C:\MyDiskSpace.Csv


I need to get he information for the disks that includes the disks that are offline as well.

Please help.
Post #1590171
Posted Tuesday, July 8, 2014 6:38 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 11:44 AM
Points: 1,293, Visits: 1,427
This uses DiskPart.exe, which may give the information you need - I tried this in powershell and it did tell me the online/offline status of local disks. Not sure how to make it work on remote servers

"List Disk" | DiskPart


output

Microsoft DiskPart version 6.1.7601
Copyright (C) 1999-2008 Microsoft Corporation.
On computer: ACA-M264

DISKPART>
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 465 GB 0 B
Disk 1 Online 29 GB 0 B
Disk 2 Offline 135 GB 1024 KB

DISKPART>


output from a windows 7 machine.

Post #1590333
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse