Win32_LogicalDisk Description property could be and wasn't quite sure how to do it with Powershell. I tried a few approaches (listed below), but, none of them worked. You can walk through each to see what it returned as an exercise:Get-WmiObject -Class Win32_LogicalDisk | select *Get-WmiObject -Class Win32_LogicalDisk | Get-MemberGet-WmiObject -Class Win32_LogicalDisk | Get-Member | select *Get-WmiObject -Class Win32_LogicalDisk | Get-Member | select * | ft -autoGet-WmiObject -Class Win32_LogicalDisk | Get-Member | select * | Format-WideGet-WmiObject -list win32_logicaldiskGet-WmiObject -class Win32_LogicalDisk | Get-Member -name DescriptionGet-WmiObject -class Win32_LogicalDisk | Get-Member -name Description | select *
At this point I decided to go a different route and look at the class definition itself. This link,
http://www.codeproject.com/KB/system/WQLByExample.aspxhelped me get the right query to figure out how to do that. The
meta_class object had escaped memory. Once I had the appropriate referenceGet-WmiObject -Query "select * from meta_class where __Class = 'Win32_LogicalDisk'"As noted in the article,Schema queries are used to get information about WMI itself and its structure.To illustrate how to use this, the author gives and example,
Select * From Meta_Class and explains,This is the most basic schema query. You can connect to any WMI namespace and use this query to get all the classes present in it. Meta_Class is a meta class used only in schema queries.There are several other directions I could go with this, but, I don't want to get too far off into WMI details. When you run the query listed above to gather __Class details for Win32_LogicalDisk it returns specific properties and class definitions for each property. Here is my walkthrough to get the specific properties and their definitions:PS > Get-WmiObject -Query "select * from meta_class where __Class = 'Win32_LogicalDisk'"
NameSpace: ROOT\cimv2
Name Methods Properties
---- ------- ----------
Win32_LogicalDisk {SetPowerState, R... {Access, Availability, BlockSize, Caption...}
PS > $Win32_LogicalDisk = Get-WmiObject -Query "select * from meta_class where __Class = 'Win32_LogicalDisk'"
PS > $Win32_LogicalDisk.__CLASS
Win32_LogicalDisk
PS > $Win32_LogicalDisk | % {$_}
NameSpace: ROOT\cimv2
Name Methods Properties
---- ------- ----------
Win32_LogicalDisk {SetPowerState, R... {Access, Availability, BlockSize, Caption...}
PS > $Win32_LogicalDisk | % {$_.Properties}
Name : Access
Value :
Type : UInt16
IsLocal : False
IsArray : False
Origin : CIM_StorageExtent
Qualifiers : {CIMTYPE, read}
Name : Availability
Value :
Type : UInt16
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIMTYPE, MappingStrings, read, ValueMap}
Name : BlockSize
Value :
Type : UInt64
IsLocal : False
IsArray : False
Origin : CIM_StorageExtent
Qualifiers : {CIMTYPE, MappingStrings, read}
Name : Caption
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_ManagedSystemElement
Qualifiers : {CIMTYPE, MaxLen, read}
Name : Compressed
Value :
Type : Boolean
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, MappingStrings, read}
Name : ConfigManagerErrorCode
Value :
Type : UInt32
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIMTYPE, read, ValueMap}
Name : ConfigManagerUserConfig
Value :
Type : Boolean
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIMTYPE, read}
Name : CreationClassName
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIM_Key, CIMTYPE, read}
Name : Description
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_ManagedSystemElement
Qualifiers : {CIMTYPE, read}
Name : DeviceID
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIM_Key, CIMTYPE, key, MappingStrings...}
Name : DriveType
Value :
Type : UInt32
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, MappingStrings, read}
Name : ErrorCleared
Value :
Type : Boolean
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIMTYPE, read}
Name : ErrorDescription
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIMTYPE, read}
Name : ErrorMethodology
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_StorageExtent
Qualifiers : {CIMTYPE, read}
Name : FileSystem
Value :
Type : String
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, MappingStrings, read}
Name : FreeSpace
Value :
Type : UInt64
IsLocal : False
IsArray : False
Origin : CIM_LogicalDisk
Qualifiers : {CIMTYPE, read}
Name : InstallDate
Value :
Type : DateTime
IsLocal : False
IsArray : False
Origin : CIM_ManagedSystemElement
Qualifiers : {CIMTYPE, MappingStrings, read}
Name : LastErrorCode
Value :
Type : UInt32
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIMTYPE, read}
Name : MaximumComponentLength
Value :
Type : UInt32
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, MappingStrings, read}
Name : MediaType
Value :
Type : UInt32
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, MappingStrings, read}
Name : Name
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_ManagedSystemElement
Qualifiers : {CIMTYPE, read}
Name : NumberOfBlocks
Value :
Type : UInt64
IsLocal : False
IsArray : False
Origin : CIM_StorageExtent
Qualifiers : {CIMTYPE, MappingStrings}
Name : PNPDeviceID
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIMTYPE, read}
Name : PowerManagementCapabilities
Value :
Type : UInt16
IsLocal : False
IsArray : True
Origin : CIM_LogicalDevice
Qualifiers : {CIMTYPE, read}
Name : PowerManagementSupported
Value :
Type : Boolean
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIMTYPE, read}
Name : ProviderName
Value :
Type : String
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, MappingStrings, read}
Name : Purpose
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_StorageExtent
Qualifiers : {CIMTYPE, read}
Name : QuotasDisabled
Value :
Type : Boolean
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, read}
Name : QuotasIncomplete
Value :
Type : Boolean
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, read}
Name : QuotasRebuilding
Value :
Type : Boolean
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, read}
Name : Size
Value :
Type : UInt64
IsLocal : False
IsArray : False
Origin : CIM_LogicalDisk
Qualifiers : {CIMTYPE, read}
Name : Status
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_ManagedSystemElement
Qualifiers : {CIMTYPE, MaxLen, read, ValueMap}
Name : StatusInfo
Value :
Type : UInt16
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIMTYPE, MappingStrings, read, ValueMap}
Name : SupportsDiskQuotas
Value :
Type : Boolean
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, read}
Name : SupportsFileBasedCompression
Value :
Type : Boolean
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, MappingStrings, read}
Name : SystemCreationClassName
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIM_Key, CIMTYPE, Propagated, read}
Name : SystemName
Value :
Type : String
IsLocal : False
IsArray : False
Origin : CIM_LogicalDevice
Qualifiers : {CIM_Key, CIMTYPE, Propagated, read}
Name : VolumeDirty
Value :
Type : Boolean
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, MappingStrings, read}
Name : VolumeName
Value :
Type : String
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, MappingStrings, read, write}
Name : VolumeSerialNumber
Value :
Type : String
IsLocal : True
IsArray : False
Origin : Win32_LogicalDisk
Qualifiers : {CIMTYPE, MappingStrings, read}
0 comments:
Post a Comment