It is not uncommon to end up with a number of shares on a server, be it Windows, Mac OS X or Linux. With all of this sprawl it can be useful to see the shares in a quick and concise manner. using the Win32_Share WMI class through PowerShell you can do just that from the command line, similar to the sharing command in Mac OS X Server. The command, from PowerShell would be something similar to the following:
get-WmiObject -class Win32_Share
Assuming communication is working as intended, you can also query for the shares of other systems, by adding a -computer switch and specifying the host you’re listing shares on, as follows:
get-WmiObject -class Win32_Share -computer dc1.krypted.com
One can also list shared printers with a little trickeration in the {} side of things:
get-WmiObject -list | where {$_.name -match “Printer”}