Using ADSI to list all shares on a computer 
Author Message
 Using ADSI to list all shares on a computer

I have the following piece of code that is supposed to list the shares on a
computer.

Set fserv = GetObject("WinNT://w2kasrv/lanmanserver")
For Each share In fserv
    MsgBox share.Name
Next

The code works fine when it queries a NT 4.0 system but I get the following
error when it queries a Windows 2000 system

  Line: 3
  Char: 2
  Error: Object require 'share"
  Code: 800A01A8
  Source: Microsoft VBScript runtime error

What am I doing wrong?  Or is this a bug?  I also need the code to show
"hidden" shares. The hidden shares aren't there when I enumerate them on NT
4.0. How do I see them?

Thanks

Kjell Magne Gabrielsen



Thu, 27 Nov 2003 21:23:40 GMT  
 Using ADSI to list all shares on a computer
It works on my win2k machine. Do you have the proper access rights?

Wim
--
http://www.admin911.com
http://www.win2kwereld.nl



Quote:
> I have the following piece of code that is supposed to list the shares on
a
> computer.

> Set fserv = GetObject("WinNT://w2kasrv/lanmanserver")
> For Each share In fserv
>     MsgBox share.Name
> Next

> The code works fine when it queries a NT 4.0 system but I get the
following
> error when it queries a Windows 2000 system

>   Line: 3
>   Char: 2
>   Error: Object require 'share"
>   Code: 800A01A8
>   Source: Microsoft VBScript runtime error

> What am I doing wrong?  Or is this a bug?  I also need the code to show
> "hidden" shares. The hidden shares aren't there when I enumerate them on
NT
> 4.0. How do I see them?

> Thanks

> Kjell Magne Gabrielsen



Fri, 28 Nov 2003 00:55:18 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Creating a share on a Windows95 computer using ADSI

2. ADSI computer list

3. ADSI Computer list

4. Creating a SHARE using ADSI

5. Share info Using Active Directory Services (ADSI)

6. get computer information using adsi

7. List Shared Folders of Computer with IP ??

8. List Shared Folders of Computer with IP ??

9. Using VB to copy a file from a network share to a client computer

10. How can I set permission on a share using VB/ADSI

11. Finding a share using ADSI and WSH

12. Trying to handle share and local permissions using ADSI 2.5

 

 
Powered by phpBB® Forum Software