Re: can't use "NET USE" at windows services
From: Mullin Yu (mullin_yu_at_ctil.com)
Date: 02/19/04
- Next message: Martin Schulze: "Custom UserControl with subcontrols (designer support)"
- Previous message: Chad Z. Hower aka Kudzu: "Re: Mutex question"
- In reply to: Willy Denoyette [MVP]: "Re: can't use "NET USE" at windows services"
- Next in thread: Willy Denoyette [MVP]: "Re: can't use "NET USE" at windows services"
- Reply: Willy Denoyette [MVP]: "Re: can't use "NET USE" at windows services"
- Messages sorted by: [ date ] [ thread ]
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());
> >
> > }
> >
> > }
> >
> >
>
>
- Next message: Martin Schulze: "Custom UserControl with subcontrols (designer support)"
- Previous message: Chad Z. Hower aka Kudzu: "Re: Mutex question"
- In reply to: Willy Denoyette [MVP]: "Re: can't use "NET USE" at windows services"
- Next in thread: Willy Denoyette [MVP]: "Re: can't use "NET USE" at windows services"
- Reply: Willy Denoyette [MVP]: "Re: can't use "NET USE" at windows services"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|