Announcement

Collapse
No announcement yet.

Rename Network Drive VBS

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rename Network Drive VBS

    I'me trying to rename a network drive from a path to a name. I've been trying this

    Set oShell = CreateObject("Shell.Application")
    oShell.NameSpace("W:\").Self.Name = "OneDrive"

    But it doesn't do anything and its the same example I find on every scripting site

  • #2
    Re: Rename Network Drive VBS

    It works for me. Does the drive already exist?

    Is this part of a larger VBScript?

    Silly question but are you putting this code in a text file with the .vbs extension and running the file?

    Edit: here's a nice breakdown of the process http://computerperformance.co.uk/Log...ive_rename.htm
    Regards,
    Jeremy

    Network Consultant/Engineer
    Baltimore - Washington area and beyond
    www.gma-cpa.com

    Comment


    • #3
      Re: Rename Network Drive VBS

      The script I'm working on maps the drive to the WebDAV share but the staff wants it renames something easier for the users to recognize. For some reason the script works on our windows 8 PCs but on Windows 7 it maps the drive but the rename portion doesn't work. The drive doesn't exist for users as we use mandatory profiles and its blank when they first login each time. Yes I'm running it as a vbs script

      I think I used that site to get the commands for creating the over all script

      Comment


      • #4
        Re: Rename Network Drive VBS

        Interesting. Have you tried running the rename portion of the script after manually creating the drive mapping?

        In your original script, does the drive map successfully to W
        Regards,
        Jeremy

        Network Consultant/Engineer
        Baltimore - Washington area and beyond
        www.gma-cpa.com

        Comment


        • #5
          Re: Rename Network Drive VBS

          Yes I've tried that on my windows 8 PC and on the 7 on the * it works and 7 no. In both cases it maps the drive successfully

          Comment


          • #6
            Re: Rename Network Drive VBS

            Just to clarify, you're saying that after you mapped the W: drive, you ran just the portion of the script to rename the drive?

            Do you get any error when running on Win 7?
            Is UAC turned on?
            Regards,
            Jeremy

            Network Consultant/Engineer
            Baltimore - Washington area and beyond
            www.gma-cpa.com

            Comment


            • #7
              Re: Rename Network Drive VBS

              Yes, also after looking at it on the machines that the rename isn't working if I open an App for example notepad and do a file save as. The window there shows that drive with the new name. But In My computer it doesn't show the new name.

              Comment


              • #8
                Re: Rename Network Drive VBS

                Ok, I think it's just a refresh issue then.
                On the Win 7 computers, can you press F5 when looking at the drives and see if that updates the label?
                Regards,
                Jeremy

                Network Consultant/Engineer
                Baltimore - Washington area and beyond
                www.gma-cpa.com

                Comment


                • #9
                  Re: Rename Network Drive VBS

                  F5 didn't work but stopping and restarting Explorer.exe did. I decided to go another direction and just add a shortcut to the Network places pointing to the drive I want for the users. They don't know the difference and it works.

                  Thanks for your help

                  Comment


                  • #10
                    Re: Rename Network Drive VBS

                    Sounds good. Thanks for posting your solution!
                    Regards,
                    Jeremy

                    Network Consultant/Engineer
                    Baltimore - Washington area and beyond
                    www.gma-cpa.com

                    Comment


                    • #11
                      Re: Rename Network Drive VBS

                      No problem, thanks for the help

                      Comment


                      • #12
                        Re: Rename Network Drive VBS

                        So I've run into an intermittent problem deploying the script to the domain. On some users at various times when it runs at login they get this error popup. "the operation being requested was not performed because the user has not been authenticated" By the time they call me I can remote in and run it manually and it works. Or if I have them just log off and back in it seems to usually run the second time. I can't trace down why this is randomly happening

                        Comment

                        Working...
                        X