I am working on a VPN dialer that will execute a login script when the connection is successfull using the following method.
Process p = new Process();
try
{
p.StartInfo.UseShellExecute = true;
p.StartInfo.FileName = @"\\serverName\NETLOGON\Script Test.cmd";
p.Start();
p.WaitForExit();
}
}
catch (Exception ex)
{
}
The batch file execute properly according to the logging methods in the batch file, but the drives are not acctualy mapped for the user to use. Other batch files tested (local & remote) have the same result.
I am assuming this has something to do with the application domain or UAC. The finished application will run on Viata/7 and is being tested on Windows 7.
Any help here would be greatly appreciated.
Regards
Bert
Mapped Drives are stored in a users profile. Which typically gets loaded when the person logs in. The most common way to get access to profile associated resources is to impersonate the user.
There is a relationally poor (PInvoke) example of how to do this here:
http://support.microsoft.com/kb/306158#4
But generally using mapped drives from a script is asking for trouble. IMHO 🙂
Hope that helps,
Jan