Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Powershell script to get the Disks that are offline


Powershell script to get the Disks that are offline

Author
Message
Mac1986
Mac1986
SSC Veteran
SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)SSC Veteran (278 reputation)

Group: General Forum Members
Points: 278 Visits: 787
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.
Tom Brown
Tom  Brown
Ten Centuries
Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)Ten Centuries (1.3K reputation)

Group: General Forum Members
Points: 1342 Visits: 1466
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.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search