Jump to content
Sign in to follow this  

Run a program from a share that requires credentials to the share

Recommended Posts

Hi all,

There is a few net use scripts to map a drive,
but What I want to do is replace bat file which was a shortcut on the users desktop and it connected to a non domain server with a username and password from the non domain server, and then launch a program from that server. (Its not mapping the drive its just making a connection so it can run the app)

Currently the users have this bat file that they run

echo off
net use \\Server1 password /USER:user
start \\Server1\APP\App.exe

What I want to do is create a script that does the same thing and then compile it so the credentials are not accessible  

This is the closest thing I can find, but I couldn't get it to work,

Any ideas?



Share this post

Link to post
Share on other sites

Look at DriveMapAdd with a empty string for the drive letter.  This will just make a connection, and not map a drive.  Also, since the server is not on the domain, the domain for the user name will be the server name itself.  Give this a try.  

Global $sServer = "Server1"
Global $sShare = "\\" & $sServer & "\APP"
Global $sAppPath = $sShare & "\App.exe"
Global $sUserName = "user"
Global $sPassword = "password"

DriveMapAdd("", $sShare, 0, $sServer & "\" & $sUserName, $sPassword)




Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Create New...