Keep in mind that it will depend on whether or not you're getting multiple WMI class instances back from the Get-WmiObject
command or not.
If you want logical disk information for the c:\
drive, then you can do the following:
$Disk = Get-WmiObject -Class Win32_LogicalDisk -Filter "Name = 'c:'";
$Disk.FreeSpace; # In bytes
$Disk.Size; # In bytes
If you want BIOS information, do the following:
$BIOS = Get-WmiObject -Class Win32_BIOS;
$BIOS.SMBIOSBIOSVersion;
$BIOS.SerialNumber;
In the two prior examples, we are only dealing with a single WMI class instance: 1) a single "logical disk" instance, and 2) a single "BIOS" instance. If you're getting multiple WMI instances back (eg. multiple printer objects), you will have to iterate over each instance using a foreach
loop:
$PrinterList = Get-WmiObject -Class Win32_Printer;
foreach ($Printer in $PrinterList) {
$Printer.Name;
}
On a side note, I would recommend avoiding the use of the Win32_Product
WMI class, as it oddly invokes a repair on all MSI (Windows Installer) software packages. For more information about this issue, see this blog post: http://myitforum.com/cs2/blogs/gramsey/archive/2011/01/25/win32-product-is-evil.aspx