2008-09-23

List Windows Shares using PowerShell

A list of shares on a given Windows host can be created by:
Get-WmiObject Win32_Share

But the two shares "IPC$" og "ADMIN$" is not really interesting.
A more usefull list can be created by:
Get-WmiObject -Query "SELECT * FROM Win32_Share WHERE Name != 'ADMIN$' AND Name != 'IPC$'"

I know it's not correct or nice to use "SELECT *...", but this is an quick and dirty example.

The WMI class definition can be browsed in WMI CIM Studio, that can be downloaded from Microsoft.
Please use your preferred internet search site to get the current URI.

No comments: