Re: can't use "NET USE" at windows services

From: Mullin Yu (mullin_yu_at_ctil.com)
Date: 02/19/04


Date: Thu, 19 Feb 2004 16:37:28 +0800

In fact, I want to logon the the print server by using a domain account as a
window service so that everytime reboot the machine, the application can
print.

now, everytime after rebooting, i need to logon as a domain user to the
print server machine, and then my background application can then do the
printing. i have the limitation that even no one logs on to the computer,
the background application is still workable.

therefore, i want to change the manual work "running net use at command
line" to a windows service so that

1. can run even no one logs on
2. no need to afraid of forgetting logging on to the print server

thanks!

mullin

"Willy Denoyette [MVP]" <willy.denoyette@pandora.be> wrote in message
news:uHXv7Js9DHA.888@tk2msftngp13.phx.gbl...
> Network logon sessions are tied to the windows logon session of the
caller.
> That means if you create a network session by calling 'NET USE' from a
> service, this session is private to the windows logon session of the
service
> (running as localsystem). The interactive user can't use this network
> session as he run's in another logon session.
>
> What exactly are you trying to achieve?
>
> Willy.
>
> "Mullin Yu" <mullin_yu@ctil.com> wrote in message
> news:OgkqS$r9DHA.4080@tk2msftngp13.phx.gbl...
> > if i put the same code at the windows application or console, i can
logon
> > to
> > the computer. but, if i put the same code at the windows service and
start
> > it, i still can't logon to the machine.
> >
> > the return value is TRUE.
> >
> > i tested it by going to windows explorer and then click that computer.
> >
> > my coding at windows service:
> >
> > protected override void OnStart(string[] args)
> >
> > {
> >
> > // TODO: Add code here to start your service.
> >
> > // logon to a print server machine
> >
> > try
> >
> > {
> >
> > Log("starting");
> >
> > Process p = new Process();
> >
> > p.StartInfo.RedirectStandardOutput = false;
> >
> >
> >
> >
> > p.StartInfo.FileName = "net";
> >
> > p.StartInfo.Arguments = @"use \\solmis password123 /user:""sol\johnny
> > yu""";
> >
> > p.StartInfo.UseShellExecute = true;
> >
> > bool rtn = p.Start();
> >
> > Log("result: " + rtn.ToString());
> >
> > }
> >
> > catch(Exception ex)
> >
> > {
> >
> > Debug.WriteLine(ex.ToString());
> >
> > Log(ex.ToString());
> >
> > }
> >
> > }
> >
> >
>
>



Relevant Pages

  • Re: cant use "NET USE" at windows services
    ... Network logon sessions are tied to the windows logon session of the caller. ... if i put the same code at the windows service and start ...
    (microsoft.public.dotnet.languages.csharp)
  • cant use "NET USE" at windows services
    ... if i put the same code at the windows application or console, ... if i put the same code at the windows service and start ... i still can't logon to the machine. ... // logon to a print server machine ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: cant use "NET USE" at windows services
    ... > if i put the same code at the windows application or console, ... if i put the same code at the windows service and start ... i still can't logon to the machine. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: How to force a logoff in a logon script?
    ... Windows has a registry key that governs which UI will be presented ... the unauthorized user cancels the logon dialog and goes away ... system, but complains that there was no cancel button, only an OK ...
    (microsoft.public.windows.server.scripting)
  • Re: When utilizing "Switch User" the music "NEVER" Stops!
    ... 2004 Windows MVP "Winny" Award ... Switch User, changing logons and checking the top of Zone ... >logging onto the 2nd logon and then logging off and back ... >>NEVER stopped thru any of the screens ?? ...
    (microsoft.public.windowsxp.general)

Loading