.net - psexec and process.start, waitforexit -



.net - psexec and process.start, waitforexit -

task : re-create file remote pc remote pc using admin account

code :

psi.filename = "cmd.exe" psi.arguments = parastr psi.username = struserid psi.password = converttosecurestring(txtadminpassword.text) psi.domain = strdomain psi.windowstyle = processwindowstyle.normal psi.useshellexecute = false dim proc new process proc.startinfo = psi proc.start()

parastr= /k psexec.exe -h /user adminuser \sourcemachine cmd /c re-create \sourcepc\file1 \destpc\folder

so when executing command, prompts admin password , 1 time verified , copies file , end

this working fine

i want check when actual re-create work done (the files size unknown , sometime takes more 3/4 hrs)

i maintain cmd window open see if process over, homecoming message task completed or failed in command prompt

how can check through vb , when process on ?

on console application can set process exit code , check same on parent calling process , based on exit code can decide success of not

you can homecoming main if declare main method homecoming int, or phone call environment.exit(code)

to check exit code

p.startinfo = new processstartinfo("regsvr32"); p.start(); p.waitforexit(); homecoming p.exitcode;

.net vb.net psexec

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

How do you set up a perforce server to work over the internet? -

ios - Lagging ScrollView with UIWebview inside -