In addition to using net share
, you can also use wmic - this allows you to query remote systems (with /node:
) and also get only those you're interested in, eg.
List shares named Share1.
wmic /node:Server1 share where name="Share1" get name,path`
Pattern match to find only shares containing temp:
wmic share where 'name like ^"^%temp^%"' get name,path
Please note those strange looking ^
are carets - cmd escape char - those are used to avoid cmd to expand env. variables. If used from within wmic, they are not needed.
Finally, you could execute this against many machines at once and save list as nicely formatted html table (among other formats):
wmic /node:server1,server2 /output:shares.html share get name,path /format:htable
(you could also use a file to specify hosts with wmic /node: @file
)