Link to home
Start Free TrialLog in
Avatar of netlisa22
netlisa22

asked on

File System object in VbScript

I have a piece of code that will read a folder and check each file's modified date. I want to read a file that exists on a server that is on a different domain. I have a specific login, password and domain that I use to map this drive manually.

Is there a way to pass a login/password/domain to the VBScript GetFolder method? Or some alternative that will allow me to read files on this remote server?

Here is the code that I am using. As long as the user that executes this code has permissions on this folder, I am fine. But when I move out of the domain, the code fails due to permissions errors.

            Set fso = CreateObject ("Scripting.FileSystemObject")
            filePath = AryDrives(x)
            Set f = fso.GetFolder(filePath)
Avatar of CooPzZ
CooPzZ
Flag of Australia image

If you are doing this to only one other domain the quick and easy way would be to wrap the FilesystemObject into another Com object and create a new application in com+ services. Change the Identity to suit the proper authorisation and you should get access. worked for me.

ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well I know the solution I provided works (I use it)

>>Or some alternative that will allow me to read files on this remote server?

and it is an alternative.