Click here to Skip to main content
15,888,984 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to Control Devices with USB ? Pin
Dave Kreskowiak18-Sep-07 16:21
mveDave Kreskowiak18-Sep-07 16:21 
QuestionHelp Timer Not Accurate Pin
laura131618-Sep-07 11:22
laura131618-Sep-07 11:22 
AnswerRe: Help Timer Not Accurate Pin
Pete O'Hanlon18-Sep-07 11:26
mvePete O'Hanlon18-Sep-07 11:26 
AnswerRe: Help Timer Not Accurate Pin
Giorgi Dalakishvili18-Sep-07 20:30
mentorGiorgi Dalakishvili18-Sep-07 20:30 
QuestionReading an MDB with that read a directory and move files. Pin
gmelkhunter18-Sep-07 11:14
gmelkhunter18-Sep-07 11:14 
AnswerRe: Reading an MDB with that read a directory and move files. Pin
ChrisKo18-Sep-07 11:27
ChrisKo18-Sep-07 11:27 
GeneralRe: Reading an MDB with that read a directory and move files. Pin
gmelkhunter18-Sep-07 13:12
gmelkhunter18-Sep-07 13:12 
QuestionExecute a remote .exe file with switches using Proccess class Pin
Don Dang18-Sep-07 10:43
Don Dang18-Sep-07 10:43 
I am writing an Excel program using C# to populate each worksheet with data from a remote machine in my workbook. Depending on the name of the worksheet I need to connect to the different servers to gather the LUN(disk size info) information. The LUN information is too complicated to gather using SQL. Also, the vendor doesn't want to supply me with the SQL script. The vendor had supplied the HSMDiskStatus.exe that can gather these information. The HSMDiskStatus.exe can be execute with the following switches:
HSDDiskStatus.exe /f e:\DPSan_Chart\" + servername + ".txt"
the /f switch tell the executable where to save the txt file.

I am using the Process class to do this but I am not having any luck. I either get "parameter is invalid" or the "specified can't be found." Is there a way to check if you are connected to the remote server using Process class during debug?

thank you very much,

Donjuanwu

Below is my code:

private void ConnectToDataServer(string servername)
{
try
{
//server and directory when connect
string execPath = @"\\" + servername + @"\E:datacenter\";
string filePath = execPath + "HSMDiskStatus.exe";
string password = "password";


Process proc = new Process();
//******don't know if Proc.StartInfo.Arguments is where I need to set the switches to execute the
********HSMDiskStatus.exe
proc.StartInfo.Arguments = " " + @"/F e:\DPSanChart\" + servername + ".txt";
//switches to include when executing HSMDiskStatus.exe
string cmdLine = @"/F e:\DPSanChart\" + servername + ".txt";

proc.StartInfo.Domain = servername;
proc.StartInfo.FileName = filePath;
proc.StartInfo.UserName = @"domain\username";

System.Security.SecureString secret = new System.Security.SecureString();
foreach (char c in password)
{
secret.AppendChar(c);
}

proc.StartInfo.UseShellExecute = false;
proc.StartInfo.Password = secret;
proc.StartInfo.WorkingDirectory = execPath;
//*********I can't inclue any arguments in Proc.Start(). I have to use
***********System.Diagnostics.Process.Start()
System.Diagnostics.Process.Start("HSMDiskStatus.exe " + cmdLine);


//proc.Start();
while (!proc.HasExited)
{
proc.Refresh();
}
proc.Close();

}
catch (Exception ex)
{
throw ex;
}
}
AnswerRe: Execute a remote .exe file with switches using Proccess class [modified] Pin
PIEBALDconsult18-Sep-07 10:57
mvePIEBALDconsult18-Sep-07 10:57 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Don Dang18-Sep-07 11:50
Don Dang18-Sep-07 11:50 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
PIEBALDconsult18-Sep-07 13:35
mvePIEBALDconsult18-Sep-07 13:35 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Dave Kreskowiak18-Sep-07 14:08
mveDave Kreskowiak18-Sep-07 14:08 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
PIEBALDconsult18-Sep-07 15:01
mvePIEBALDconsult18-Sep-07 15:01 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Dave Kreskowiak18-Sep-07 16:16
mveDave Kreskowiak18-Sep-07 16:16 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
PIEBALDconsult18-Sep-07 16:31
mvePIEBALDconsult18-Sep-07 16:31 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Dave Kreskowiak18-Sep-07 17:20
mveDave Kreskowiak18-Sep-07 17:20 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Don Dang19-Sep-07 9:39
Don Dang19-Sep-07 9:39 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Dave Kreskowiak19-Sep-07 11:58
mveDave Kreskowiak19-Sep-07 11:58 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Don Dang19-Sep-07 12:27
Don Dang19-Sep-07 12:27 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Dave Kreskowiak19-Sep-07 15:16
mveDave Kreskowiak19-Sep-07 15:16 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
PIEBALDconsult19-Sep-07 17:52
mvePIEBALDconsult19-Sep-07 17:52 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Dave Kreskowiak20-Sep-07 1:56
mveDave Kreskowiak20-Sep-07 1:56 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Don Dang19-Sep-07 9:11
Don Dang19-Sep-07 9:11 
GeneralRe: Execute a remote .exe file with switches using Proccess class Pin
Don Dang19-Sep-07 9:20
Don Dang19-Sep-07 9:20 
AnswerRe: Execute a remote .exe file with switches using Proccess class Pin
ChrisKo18-Sep-07 11:19
ChrisKo18-Sep-07 11:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.