Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FileSystemObject troubles 1

Status
Not open for further replies.

Slarti

Programmer
Feb 5, 2003
45
0
0
GB
I'm trying to use the FileSystemObject to identify the names of folders on a server. I've tried various combination of Set fFAP = FSys.GetDrive("\\JDH00674") and get an invalid procedure call or argument, trying Set fFAP = FSys.GetFolder("\\JDH00664") I get path not found when I know the path is correct. Where am I going wrong?
 
I believe that you need to specify a share name....

"\\JDH00664\sharename
 
Yeah... you have to share the specific folder on the network.
 
Thanks bjd4jc/HydraNL that kinda negates the procedure I was trying to write which would have identified the sharenames on each server.

cheers,

S.
 
Well if that is what you want you should have said so...

I am sure there are variations of how to do this but this is what I like:

Code:
    Dim wmgts As Object
    Dim Share As Object
    Dim Server As String
    
    Server = "localhost"
    
    Set wmgts = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & Server & "\root\cimv2")
    For Each Share In wmgts.instancesof("Win32_Share")
        Debug.Print Share.Name; vbTab; Share.Path; vbTab; Share.Caption
    Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top