We help IT Professionals succeed at work.
Get Started

Select Case Userstring in login script not working

vinden asked
Last Modified: 2012-05-09

I'm trying to map some specific drives to specific users in a vbs login script.
The setup is fairly simple but for some reason the drives are mapped for every user.

strUser = WSHNetwork.UserName
Select Case strUser
    Case "User1" Or "User2"
         WSHNetwork.MapNetworkDrive "F:", "\\SERVER\DRIVE",True
         WSHNetwork.MapNetworkDrive "Y:", "\\SERVER\DRIVE2",True
         WScript.Echo strUser
End Select

Even if I execute the script as "User3" or "UserSomethingCompletelyDifferent" it still maps the drives. That's why I added an echo at the end. The echo clearly shows a different username than the usernames in the Case expression. But still the drives are mapped.
I don't get it.

Watch Question
This problem has been solved!
Unlock 2 Answers and 6 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE