dcsimg
Results 1 to 12 of 12
  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    7

    Resolved [RESOLVED] Keep getting "directory name Z:\ is invalid" while trying to connect to share drive

    I have been working on a program that needs to connect to our local share drive (Z:\) when it starts as well as while running. The program has no issues connecting when it is being run from my user account, but when any of the other user try to run the program an error message appears saying that the directory is invalid.

    In the settings menu I wrote into the program I have a section where users can change the directory paths as needed. When a new path is entered and the "Change Paths" button is clicked the program runs directory.exists() and returns msgbox("The newly input path does not exist") if false. Even though I can open, view, edit, etc. the share drive from the user's account the program seems to think the directory does not exist.

    I have the original path of the files on the share drive hard written in to the program upon initial startup. Could this be this issue? If not what is a better way of doing this? Why would I be able to open the share drive in the file explorer, but the program think it does not exist?

    Thank you for your help!

    -Sam

  2. #2
    Frenzied Member
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,105

    Re: Keep getting "directory name Z:\ is invalid" while trying to connect to share dri

    Do the other users all have the shared drive mapped as the Z: drive?

    Post the code you are using (enclose in code tags - use the # button).

    You could use the actual path instead, like this:

    \\ServerName\FolderName\SubfolderName

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    7

    Re: Keep getting "directory name Z:\ is invalid" while trying to connect to share dri

    Quote Originally Posted by jdc2000 View Post
    Do the other users all have the shared drive mapped as the Z: drive?

    Post the code you are using (enclose in code tags - use the # button).

    You could use the actual path instead, like this:

    \\ServerName\FolderName\SubfolderName
    Everywhere in the program that the file on the share drive needs to be accessed runs through this variable.

    Code:
    Public PublicHistoryXML As String = My.Settings.XMLFolder & "OrderHistory.XML"
    The actual path is set in settings, but can be changed through the settings form while running the program. Targeting the actual path work. Thank you!

    Now, I just need a way for all my user to be able to open the program without needing admin privileges.

  4. #4
    Frenzied Member
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,105

    Re: [RESOLVED] Keep getting "directory name Z:\ is invalid" while trying to connect t

    How are you providing access to your program for your users? Are you trying to have them run it from a shared network location, or do they have local copies on their computers?

  5. #5

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    7

    Re: [RESOLVED] Keep getting "directory name Z:\ is invalid" while trying to connect t

    They all have local copies on their computer.

    The program pulls the order schedule from the share drive as it opens and updates the share drive copy as users make changes. That was my best bet for sharing the order schedule between users with the short time frame I had to push initial version of this program out.
    Last edited by sblackman; Feb 26th, 2018 at 02:52 PM.

  6. #6
    Frenzied Member
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,105

    Re: [RESOLVED] Keep getting "directory name Z:\ is invalid" while trying to connect t

    If the users all have local copies of the program, those should be installed so they have rights to run them and rights to any resources the program uses (registry entries, file locations, etc.).

  7. #7

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    7

    Re: [RESOLVED] Keep getting "directory name Z:\ is invalid" while trying to connect t

    Quote Originally Posted by jdc2000 View Post
    If the users all have local copies of the program, those should be installed so they have rights to run them and rights to any resources the program uses (registry entries, file locations, etc.).
    I guess I don’t have the access for all of the resources the program requires included in the setup file. If I install the program it will runs fine under any of my employee’s usernames, but only if it’s run as admin with my login creds. What would be the best way to be sure everything is included in the setup build?

  8. #8
    Frenzied Member
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,105

    Re: [RESOLVED] Keep getting "directory name Z:\ is invalid" while trying to connect t

    That would depend on what resources your program needs. What sort of error message are you getting, and what resources are you using? Are you creating or using any registry keys, or storing/accessing any files or resources in folders that a standard user does not have permission to access?

    Examples:
    Storing files used by the program in :Program Files" would not be a good idea.
    Registry keys should be saved in an area the user has read/write permission for.

  9. #9

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    7

    Re: [RESOLVED] Keep getting "directory name Z:\ is invalid" while trying to connect t

    The only files the program needs to access are generated by itself. There are 4 files that the program needs to access. Two on the share drive and two on the user desktop. The two on the users desktop are only there until I can find a better location for them to be while the program is running. The two local files are created when the user opens the program and removed upon closing of the program.

    The message that comes up when I try to run the program without admin access is “Problem Event Name: CLR20r3”

  10. #10
    Frenzied Member
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,105

    Re: [RESOLVED] Keep getting "directory name Z:\ is invalid" while trying to connect t


  11. #11

    Thread Starter
    New Member
    Join Date
    Oct 2017
    Posts
    7

    Re: [RESOLVED] Keep getting "directory name Z:\ is invalid" while trying to connect t

    Just figured it out! (and I feel like an idiot)

    The exception was being thrown when Users didn't have admin access because I had accidentally left a path with my username in the default settings. When someone opens the program for the first time all of the paths in settings are changed to their own, other than the path for the files on the share drive. The problem was the path to "C:\Users\[My Username]\...Somewhere..." was still in settings to be replaced with "C:\Users\[Their Username]\...Somewhere...". So, When they first open the program it would try to access "C:\Users\[My Username]\...Somewhere..." before changing and throw an exception.

    It always worked when I ran it as admin because I was always using my username and password for the admin authentication. And so, I feel like an idiot.

    I removed the path from settings, leaving it blank until the user's initial startup, and now it works for everyone. Yayy!

    Thank you for your help!

  12. #12
    Frenzied Member
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    1,105

    Re: [RESOLVED] Keep getting "directory name Z:\ is invalid" while trying to connect t

    Thanks for the update.

    Hard-coded paths - not good. You should probably also have some error checking code for any file open statements, as the file might be missing, the user may have made a typo, or they don't have permissions, etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width


×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.