Run a batch file on a remote Windows 2003 server

I have a stand alone windows VB.NET application on a Windows XP machine that I'm trying to get to run a batch file on a remote server.  I'm using system.diagnostics.start to run the batch file.

The batch file is setup to use paths such as "set PFDATA=\\servername\c$\appl" etc.
I've setup a service acct of "filepro" to use when running the VB.NET application.

If I give "filepro" Domain Admin rights, then the application runs the batch file.  However, I don't want to give "filepro" Domain Admin rights.  I'd like to give him Domain User rights and then modify the folder's share/security permissions on the W2K3 server.

I don't want to use mapped drives due to the fact that if the application crashes, the mapped drives won't be disconnected from the users computer.

I've shared, and given "filepro" full control over the paths in the batch file plus the "\\servername\c$\windows" folder (for cmd.exe ?).

The program fails with a "System.ComponentModel.Win32Exception: Access is Denied"

Here is the batch file:

@echo off
set PFDSK=\\servername\c$\appl\filepro
set PFDATA=\\servername\c$\appl
set PFPROG=\\servername\c$\appl
set PFDIR=
set PFMENU=\\servername\c$\fp\menus
set PATH=%pfprog%;%PFPROG%\fp;%path%
%pfprog%\fp\p AVD01

And here is the applicable portion of the .net application:

Private Sub StartBtn_Click ...
Dim fp As Diagnostics.Process = New Diagnostics.Process
fp.StartInfo.UserName = "filepro"
fp.StartInfo.Domain = Environment.UserDomainName.ToString
Dim spwd As New System.Security.SecureString
Dim pwd As String = "********"
        Array.ForEach(pwd.ToCharArray(), AddressOf spwd.AppendChar)
        fp.StartInfo.Password = spwd
fp.StartInfo.FileName = "\\servername\c$\FP_Logins\User_Update.bat
fp.StartInfo.UseShellExecute = False
fp.StartInfo.CreateNoWindow = False

fp.Start()   '<<<Fails here>>>
End Sub
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Though the solution im providing here is not linked to - but for remote file execution i used psexec.exe from sysinternals
shelbyinfotechAuthor Commented:
Running psexec.exe in still requires a domain admin login to run "\\servername\c$\FP_Logins\User_Update.bat as the .NET service acct that VB.NET runs under doesn't have the rights.
shelbyinfotechAuthor Commented:
Is there any rights for a domain user I can setup in order for that user to access \\servername\c$\FP_Logins\User_Update.bat"
shelbyinfotechAuthor Commented:
Found the solution.

I need to use the "SHARE" name instead of the full path:

set PFDSK=\\servername\c$\appl\filepro   FAILS
set PFDSK=\\servername\filepro   WORKS  ("filepro" is the share name)

fp.StartInfo.FileName = "\\servername\c$\FP_Logins\User_Update.bat  FAILS
fp.StartInfo.FileName = "\\servername\FP_Logins\User_Update.bat    WORKS ("FP_Logins" is the share name)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.