When you query WMI classes, you may not get back all information at first:
PS> Get-CimInstance -ClassName Win32_LogicalDisk DeviceID DriveType ProviderName VolumeName Size FreeSpace -------- --------- ------------ ---------- ---- --------- C: 3 OS 1007210721280 227106992128 Z: 4 \\127.0.0.1\c$ OS 1007210721280 227106988032
Make sure to append Select-Object to get a full set of information:
PS> Get-CimInstance -ClassName Win32_LogicalDisk | Select-Object -Property * Status : Availability : DeviceID : C: StatusInfo : Caption : C: Description : Local Fixed Disk InstallDate : Name : C: ConfigManagerErrorCode : ConfigManagerUserConfig : CreationClassName : Win32_LogicalDisk ErrorCleared : ErrorDescription : LastErrorCode : PNPDeviceID : PowerManagementCapabilities : PowerManagementSupported : SystemCreationClassName : Win32_ComputerSystem SystemName : DELL7390 Access : 0 BlockSize : ErrorMethodology : NumberOfBlocks : Purpose : FreeSpace : 227111596032 Size : 1007210721280 Compressed : False DriveType : 3 FileSystem : NTFS MaximumComponentLength : 255 MediaType : 12 ProviderName : QuotasDisabled : QuotasIncomplete : QuotasRebuilding : SupportsDiskQuotas : False SupportsFileBasedCompression : True VolumeDirty : VolumeName : OS VolumeSerialNumber : DAD43A43 PSComputerName : CimClass : root/cimv2:Win32_LogicalDisk CimInstanceProperties : {Caption, Description, InstallDate, Name...} CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties Status : Availability : DeviceID : Z: StatusInfo : Caption : Z: Description : Network Connection InstallDate : Name : Z: ConfigManagerErrorCode : ConfigManagerUserConfig : CreationClassName : Win32_LogicalDisk ErrorCleared : ErrorDescription : LastErrorCode : PNPDeviceID : PowerManagementCapabilities : PowerManagementSupported : SystemCreationClassName : Win32_ComputerSystem SystemName : DELL7390 Access : 0 BlockSize : ErrorMethodology : NumberOfBlocks : Purpose : FreeSpace : 227111596032 Size : 1007210721280 Compressed : False DriveType : 4 FileSystem : NTFS MaximumComponentLength : 255 MediaType : 0 ProviderName : \\127.0.0.1\c$ QuotasDisabled : QuotasIncomplete : QuotasRebuilding : SupportsDiskQuotas : False SupportsFileBasedCompression : True VolumeDirty : VolumeName : OS VolumeSerialNumber : DAD43A43 PSComputerName : CimClass : root/cimv2:Win32_LogicalDisk CimInstanceProperties : {Caption, Description, InstallDate, Name...} CimSystemProperties : Microsoft.Management.Infrastructure.CimSystemProperties
Now you see all properties, and now you can pick the items you really need:
PS> Get-CimInstance -ClassName Win32_LogicalDisk | Select-Object -Property DeviceId, Description, FreeSpace, FileSystem DeviceId Description FreeSpace FileSystem -------- ----------- --------- ---------- C: Local Fixed Disk 227110989824 NTFS Z: Network Connection 227110989824 NTFS
ReTweet this Tip!