Solved

VB6 FileSystemObject works with UNC but not with mapped drives on Win7 PC

Posted on 2010-09-07
7
2,178 Views
Last Modified: 2012-05-10
This is happening on a customer site. I'm trying to use FileSystemObject on a Win7 PC to see if a file exists. If I use the mapped drive, a good filename returns false, UNC returns true.  I also tried an old method:
 Dir(CStr(Filename)) <> ""
Same results.

I tested this at home and I don't have a problem. Yet, I have a workgroup based network.
The customer's Win7 PC is on a domain. I do have administrative rights on that domain but mapped drive still fails. Note: UAC is turned off.

They never had a Vista PC. Just starting to deploy Win7. Previous version (Win XP) does not have the problem.

Looks like some type of Win7 rights issue, but not sure.




Function lbf_FileExist(strFileName As String) As Boolean

Dim ofso

Set ofso = CreateObject("Scripting.FileSystemObject")

        ' Check for file and return appropriate result

        If ofso.FileExists(strFileName) Then

               lbf_FileExist = True

        Else

               lbf_FileExist = False

        End If



End function

Open in new window

0
Comment
Question by:askolits
  • 3
  • 3
7 Comments
 
LVL 21

Expert Comment

by:ivanoviola
ID: 33623764
IF the script runs as administrator, then Administrator (the user) does not see the mapped drives as it runs as a different user. The mapped drives are only for currently logged in user. UNC paths work just find as long as the path exists.
0
 
LVL 6

Expert Comment

by:Caracena
ID: 33623768
How are you mapping the drive? Windows 7 has some strange behaviors when dealing with "normal" mapped drives sometimes. Try and map it from the server's user's policies (bat file) to see if the error continues.
0
 

Author Comment

by:askolits
ID: 33626618
ivanoviola: "The mapped drives are only for currently logged in user. UNC paths work just find as long as the path exists. "  
 Well it's mapped for both types of users and the issue happens both times.
 
Caracena:"Try and map it from the server's user's policies (bat file) to see if the error continues. "

I'll ask the network admin to look at this posibility.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 21

Expert Comment

by:ivanoviola
ID: 33627177
"Well it's mapped for both types of users and the issue happens both times....."
I'm not sure what you mean when you say that.

My point was that if the script runs "As Administrator" while logged in as Joe Blow, the script will not see Joe Blow's mapped drives. That's why it fails.
0
 

Author Comment

by:askolits
ID: 33627439
Hmm... Maybe.
I logged in as myself and I am an administrator and it failed. But I didnlt actualy use the "Administrator" username. I'll have to try it and see.
 
0
 
LVL 21

Expert Comment

by:ivanoviola
ID: 33627550
I've run into similar problems when programs that need to run "As Administrator", and use a mapped drive, fails to run correctly. When I change the drive mapping in the config file to a UNC path, all is good.

I think the same problem is happening to your script.
0
 

Accepted Solution

by:
askolits earned 0 total points
ID: 33628090
Well, I am going to update my code to use UNC.
I did find some code that will provide the UNC for mapped drives. But, I will probably just used the UNC for now rather than add a bunch of code.
 
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now