Question : Problem: PSEXEC

Hi,

I am trying to run a program in a remote PC from my program.
I am using "psexec" to do it.
he command is:  "C:\Program Files\Supervisor\psexec.exe" \\OFFICE -d -e \\OFFICE\C\Temp2\Temp2.exe

When I do it from a CMD window it works OK (it opens a dialog, but when I do it from ShellExecute command
   like that
   ShellExecute(NULL,"open","C:\Program Files\Supervisor\psexec.exe","\\OFFICE -d -e \\OFFICE\C\Temp2\Temp2.exe",NULL,SW_SHOW), it opens the CMD for split second (so I cannot see the error).
Questions:
1. How can I tell the CMD not to close itself, so I can see the errors?
2. When I try to run the command (from the CMD window) on another PC (e.g PC2) I get the following error: Couldn't access PC2. I can write on PC2 from my computer. How can I enable the psexec?


Answer : Problem: PSEXEC

1. add pause command after first command
2. psexec requies some things on/off. Try to run this batch file on remote pc

:: turn off simple file share
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 00000000 /f
:: turn on admin$ share XP
rem reg add "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 00000001 /f
:: enable file and print sharing in firewall
netsh firewall set service type = fileandprint mode = enable
add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v  AutoShareWks /t REG_DWORD /d 00000001 /f
Random Solutions  
 
programming4us programming4us