更新时间:2023-02-02 17:28:08
你好Kesavaraj
请查看此代码项目,然后也下载该项目.希望对您有帮助.
http://www.codeproject.com/KB/cs/Remote_Process_using_WMI_.aspx >
谢谢
How can i run the .bat file on remote server. i have pasted my code but its not working. Its ginving the following error:
Logon failure: the user has not been granted the requested logon type at this computer
string AppPath = @"\\da9741s033\d$\EmailServices\AdhocProdRun\bin\";
string strFilePath = AppPath + "ACH-DDS_Dashboard_MNTLY.bat";
System.Diagnostics.
Process proc = new System.Diagnostics.Process();proc.StartInfo.FileName = strFilePath;
string pwd = "Welcome";
proc.StartInfo.Domain =
"amrs";proc.StartInfo.UserName =
"kemani";System.Security.
SecureString secret = new System.Security.SecureString();foreach (char c in pwd)
secret.AppendChar(c);
proc.StartInfo.Password = secret;
proc.StartInfo.UseShellExecute =
false;proc.StartInfo.WorkingDirectory =
@"\\da9741s033\d$\EmailServices\AdhocProdRun\bin\";proc.Start();
while (!proc.HasExited)
{
proc.Refresh();
}
proc.Close();
can anyone help me?
Thanks,
kesav
Hello Kesavaraj
Please review this code project and download that project also. I hope it will help you.
http://www.codeproject.com/KB/cs/Remote_Process_using_WMI_.aspx
Thanks