Powershell script to get the Disks that are offline

  • 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.

  • 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.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply