Nykolai Peterson
Nykolai Peterson

Reputation: 35

View shares in powershell on remote computer that are visible from windows explorer

In windows explorer, I am able to type in \\computer.domain\ and see certain shares on that computer. My user doesn't have access to those, but I can still see them in windows explorer. In powershell, if I start typing that, i.e. dir \\computer.domain\, intellisense will give me those same shares as options to complete the path with, but leaving the path as it is will result in a DNE error. Additionally, typing Get-wmiobject win32_share -computername computer will result in an access denied error. How can I access the names of those shares that intellisense and windows explorer can show?

Upvotes: 0

Views: 1613

Answers (2)

CapitanShinChan
CapitanShinChan

Reputation: 43

I only know the "net view" utility, but it won't list hidden shares (those which finish with '$'), although you can check their existant with Get-Acl specifying their names, for example:

Get-Acl \\192.168.0.1\admin$

Upvotes: 0

Robbie Courtney
Robbie Courtney

Reputation: 81

There is only one way that I know of to enumerate shares without using WMI which requires permissions on the remote machine and that is using the native command "net view"

net view \\computername

You will have to do some parsing with PowerShell if you want to manipulate those results and use it for something else. Since "net view" is not a PowerShell Cmdlet, instead a native windows console app command it returns text, not an object as would a powershell cmdlet would. But it should get you started for what you are doing.

Upvotes: 2

Related Questions