Reputation: 327
Simple question, though I fear I wont like the answer. Currently I have a script for performing permission audits, get folders recursively then get-acl... so on and so forth.
I am using this line for a browsing part of the utility:
$Shares = Get-WmiObject -Class Win32_Share -ComputerName $text | Where-Object { $_.type -ne 1}
This is working wonderfully however I want our lowest level techs to be able to run this. They have permissions enough to perform all get-acl calls however they cannot navigate the broswer I wrote because they are not server admins, which they would have to be to perform a WMI call.
Long story short... is there a way to get a list of shares from a server without a WMI call? I cannot find a way in my googlings.... but am having a hard time accepting that because all users can type "\servername\" into their explorer and BAM there they are... must be a powershell way to mimic that.
All hints, notions and wild out-there ideas are welcome
Upvotes: 1
Views: 2417
Reputation: 36
Not sure if this will work for you but try this:
([adsi]"WinNT://$computername/LanmanServer,FileService").Children | Select-Object @(
@{n='CurrentUserCount';e={$_.CurrentUserCount}}
@{n='Name'; e={$_.Name.Value}}
@{n='Server'; e={$_.HostComputer | Split-Path -Leaf}}
@{n='Path'; e={$_.Path.Value}}
@{n='Description'; e={$_.Description.Value}}
)
Upvotes: 1
Reputation: 2363
Does net view \\computername
work for them? Type net view /?
for help on this command. Run that from a command prompt or PS prompt.
Upvotes: 2