M
Mullin Yu
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());
}
}
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());
}
}