Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Good evening,

I'm running into a strange issue on a Windows 7 machine. I'm working on deploying OpenVPN to our mobile workforce and they've requested the ability to have their home drive and another share automatically mapped when they log into the VPN.

So far, I'm using the following lines in a batch file:

net use O: \\172.23.6.127\shares /persistent:no
net use U: \\172.23.6.127\%USERNAME% /persistent:no

The command prompt opens as expected and the script executes successfully, however, I cannot see the network drives listed. If I immediately attempt to run the script manually, I get an error 53 telling me that the name is already in use.

As the image below shows, if I disconnect the VPN tunnel then reconnect without running the script automatically (i.e., by removing the UP script on the config folder), then run the batch file manually, the shares are mapped and they show up.

Image showing successful manual share mapping

Any assistance would be really appreciated, thanks.

share|improve this question

1 Answer 1

Most likely the process is being "run as administrator" which means they're mapped in a different user context than the currently logged on user, and also why it works properly when run manually. I'm assuming the OpenVPN process that calls this script is run as an administrator so that it can set the routes for the user? If so, then this is what you're seeing.

share|improve this answer
    
Yes, you're right. The OpenVPN GUI is run as administrator. So how do I elevate the batch script to also run as administrator so that they're all within the same user context? –  Kismet Agbasi Sep 16 '13 at 9:47
    
The problem is that it is already running as administrator! which is not the same as your logged on user's context. I'm not sure how to work around this with OpenVPN short off is ambling UAC, which is a bad idea. I'd consult their manuals or support. –  MDMarra Sep 16 '13 at 11:10
    
I figured out a solution to my problem. By using a tool call hstart I was able to run the batch files in non-elevated mode. I will post my solution shortly. Thanks for pointing me in the right direction. –  Kismet Agbasi Sep 17 '13 at 10:02

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.