Thanks Ben,
What I've done is to rob the example code from microsoft for user account
impersonation. Within the app, I'm authenticating (verified by intentionally
supplying an incorrect password and catching the exception) to the domain
with a domain administrator account. I do believe however that this is in
fact close to the problem, as it seems most likely as when I run the app
manually, it would be using my credentials. However, when run as a task, it
should be using my supplied credentials as well (which is failing), so I'm at
a loss for explaining that :l
[quoted text, click to view] "Ben Rush" wrote:
> Hello Ed,
>
> What user are you running your task under; what are the permissions? It's
> possible the user might not have appropriate priviledges to create the
> process.
>
>
> "Ed McAndrew" <EdMcAndrew@discussions.microsoft.com> wrote in message
> news:D9631534-DA22-4454-A92A-0412590B9162@microsoft.com...
> > I'm trying to map a network drive share in c# with:
> >
> > CreateProcess("net", @"use " + LocDrive + " " + Quotes + userShare +
> > Quotes
> > + " " + userPass + " /USER:" + userName, out exitCode, out output);
> >
> > Everything is right, and it works perfectly when the compiled executable
> > is
> > launched manually from a command line.
> >
> > However; when I attempt to use this console app from a scheduled task, the
> > create process event fails. I'm not sure what is going on. There are no
> > exceptions being thrown at all. The output is simply null
> >
> > The purpose of this executable is to run the app as a scheduled task every
> > 10 minutes to ensure that a drive mapping is still connected.
> >
> > I'm not sure how much code or what code of mine you would like to see.
> >
> > Thanks in advance,
> >
> > Ed
>
>