Scripting WMI with PowerShell is far simpler than with using the above mentioned API.
To get instances of a particular WMI class - just use get-wmiobject specifying class and (where needed) the namespace. For example:
PS C:\Documents ad Settings\LeeT> get-wmiobject win32_share | ft -auto
Name Path Description
---- ---- -----------
E$ E:\ Default share
IPC$ Remote IPC
D$ D:\ Default share
print$ C:\WINDOWS\system32\spool\drivers Printer Drivers
phaser Xerox Phaser 8560N PS,LocalsplOnly Xerox Phaser 8560N PS
ADMIN$ C:\WINDOWS Remote Admin
C$ C:\ Default share