Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Finding shares in AD with PowerShell

Reply
 
Old 03-27-2008   #1 (permalink)
CodeTestDummy


 
 

Finding shares in AD with PowerShell

All,

Is WMI the best way to find all the share on an AD server and the share's
permissions? Or is there a better way with Powershell?


Thanks in advance.



My System SpecsSystem Spec
Old 03-27-2008   #2 (permalink)
Brandon Shell [MVP]


 
 

Re: Finding shares in AD with PowerShell

Can you clarify what you mean by AD Server? Domain Controller?

Also, what do yo mean by shares? Do you mean published shares in AD or computer
shares?

Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

C> All,
C>
C> Is WMI the best way to find all the share on an AD server and the
C> share's permissions? Or is there a better way with Powershell?
C>
C> Thanks in advance.
C>


My System SpecsSystem Spec
Old 03-27-2008   #3 (permalink)
CodeTestDummy


 
 

Re: Finding shares in AD with PowerShell

Brandon, thanks for the quick response.

I want to find both published shares in AD and computer shares on all
servers.



"Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
news:29d4f6464ce98ca5e2f2028c41f@xxxxxx
Quote:

> Can you clarify what you mean by AD Server? Domain Controller?
> Also, what do yo mean by shares? Do you mean published shares in AD or
> computer shares?
>
> Brandon Shell
> ---------------
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
>
> C> All,
> C> C> Is WMI the best way to find all the share on an AD server and the
> C> share's permissions? Or is there a better way with Powershell?
> C> C> Thanks in advance.
> C>
>

My System SpecsSystem Spec
Old 03-27-2008   #4 (permalink)
Brandon Shell [MVP]


 
 

Re: Finding shares in AD with PowerShell

Are you using windows 2000? I believe they removed published shares post 2k.

WMI is you best bet.


Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

C> Brandon, thanks for the quick response.
C>
C> I want to find both published shares in AD and computer shares on all
C> servers.
C>
C> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
C> news:29d4f6464ce98ca5e2f2028c41f@xxxxxx
C>
Quote:
Quote:

>> Can you clarify what you mean by AD Server? Domain Controller?
>> Also, what do yo mean by shares? Do you mean published shares in AD
>> or
>> computer shares?
>> Brandon Shell
>> ---------------
>> Blog: http://www.bsonposh.com/
>> PSH Scripts Project: www.codeplex.com/psobject
>> C> All,
>> C> C> Is WMI the best way to find all the share on an AD server and
>> the
>> C> share's permissions? Or is there a better way with Powershell?
>> C> C> Thanks in advance.
>> C>

My System SpecsSystem Spec
Old 03-27-2008   #5 (permalink)
RichS


 
 

Re: Finding shares in AD with PowerShell

To find the WMI classes that deal with shares

Get-WmiObject -List | Where{$_.Name -like "*share*"}

To see shares on local machine

Get-WmiObject -Class Win32_Share

To search remote machines - create a csv file with the server names 1 per
line & a header row of Server

Import-Csv | Foreach {Get-WmiObject -Class Win32_Share -ComputerName
$_.Server}





--
Richard Siddaway
Please note that all scripts are supplied "as is" and with no warranty
Blog: http://richardsiddaway.spaces.live.com/
PowerShell User Group: http://www.get-psuguk.org.uk


"Brandon Shell [MVP]" wrote:
Quote:

> Are you using windows 2000? I believe they removed published shares post 2k.
>
> WMI is you best bet.
>
>
> Brandon Shell
> ---------------
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
>
> C> Brandon, thanks for the quick response.
> C>
> C> I want to find both published shares in AD and computer shares on all
> C> servers.
> C>
> C> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
> C> news:29d4f6464ce98ca5e2f2028c41f@xxxxxx
> C>
Quote:
Quote:

> >> Can you clarify what you mean by AD Server? Domain Controller?
> >> Also, what do yo mean by shares? Do you mean published shares in AD
> >> or
> >> computer shares?
> >> Brandon Shell
> >> ---------------
> >> Blog: http://www.bsonposh.com/
> >> PSH Scripts Project: www.codeplex.com/psobject
> >> C> All,
> >> C> C> Is WMI the best way to find all the share on an AD server and
> >> the
> >> C> share's permissions? Or is there a better way with Powershell?
> >> C> C> Thanks in advance.
> >> C>
>
>
>
My System SpecsSystem Spec
Old 03-27-2008   #6 (permalink)
CodeTestDummy


 
 

Re: Finding shares in AD with PowerShell

I am using XP, servers are Win2k and Win2k3. So, you think WMI is my best
bet to get published shares in AD, computer\server shares and their
permissions?


"Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
news:29d4f6464cf18ca5e3adb0f7296@xxxxxx
Quote:

> Are you using windows 2000? I believe they removed published shares post
> 2k.
>
> WMI is you best bet.
>
>
> Brandon Shell
> ---------------
> Blog: http://www.bsonposh.com/
> PSH Scripts Project: www.codeplex.com/psobject
>
> C> Brandon, thanks for the quick response.
> C> C> I want to find both published shares in AD and computer shares on
> all
> C> servers.
> C> C> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
> C> news:29d4f6464ce98ca5e2f2028c41f@xxxxxx
> C>
Quote:
Quote:

>>> Can you clarify what you mean by AD Server? Domain Controller?
>>> Also, what do yo mean by shares? Do you mean published shares in AD
>>> or
>>> computer shares?
>>> Brandon Shell
>>> ---------------
>>> Blog: http://www.bsonposh.com/
>>> PSH Scripts Project: www.codeplex.com/psobject
>>> C> All,
>>> C> C> Is WMI the best way to find all the share on an AD server and
>>> the
>>> C> share's permissions? Or is there a better way with Powershell?
>>> C> C> Thanks in advance.
>>> C>
>
>

My System SpecsSystem Spec
Old 03-27-2008   #7 (permalink)
Brandon Shell [MVP]


 
 

Re: Finding shares in AD with PowerShell

WMI is the way to go.

You can use this

Get-WmiObject Win32_Share -comp $servername

for permissions you could use get-acl

(get-acl \\$ServerName\Share).Access



Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

C> I am using XP, servers are Win2k and Win2k3. So, you think WMI is my
C> best bet to get published shares in AD, computer\server shares and
C> their permissions?
C>
C> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in message
C> news:29d4f6464cf18ca5e3adb0f7296@xxxxxx
C>
Quote:
Quote:

>> Are you using windows 2000? I believe they removed published shares
>> post 2k.
>>
>> WMI is you best bet.
>>
>> Brandon Shell
>> ---------------
>> Blog: http://www.bsonposh.com/
>> PSH Scripts Project: www.codeplex.com/psobject
>> C> Brandon, thanks for the quick response.
>> C> C> I want to find both published shares in AD and computer shares
>> on
>> all
>> C> servers.
>> C> C> "Brandon Shell [MVP]" <a_bshell.mask@xxxxxx> wrote in
>> message
>> C> news:29d4f6464ce98ca5e2f2028c41f@xxxxxx
>> C>
Quote:

>>>> Can you clarify what you mean by AD Server? Domain Controller?
>>>> Also, what do yo mean by shares? Do you mean published shares in AD
>>>> or
>>>> computer shares?
>>>> Brandon Shell
>>>> ---------------
>>>> Blog: http://www.bsonposh.com/
>>>> PSH Scripts Project: www.codeplex.com/psobject
>>>> C> All,
>>>> C> C> Is WMI the best way to find all the share on an AD server and
>>>> the
>>>> C> share's permissions? Or is there a better way with Powershell?
>>>> C> C> Thanks in advance.
>>>> C>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
One system finding old but not current shares on another Vista networking & sharing
PowerShell Leaders Join Forces and offer a pre-release version of PowerShell for 50% off the retail value PowerShell
Able to access shares from Vista, but not acces Vista shares. Vista networking & sharing
finding the logged on user (user name) with powershell using WMI? PowerShell
How can I finding orphaned link file reference in HTML (PowerShell PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46