Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Kill remote process
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP1
Divers
Thread ID:
01142445
Message ID:
01142467
Vues:
7
This message has been marked as the solution to the initial question of the thread.
Hi Mark,

You can use WMI for this:
FUNCTION KillProcess(lcExe,lcMachine)

lcMoniker = "winmgmts://" + IIF(!EMPTY(lcMachine),lcMachine + "/","")
oWMI = GETOBJECT(lcMoniker)
loProcesses = oWMI.InstancesOf("Win32_Process")
lcExe = LOWER(lcEXE)

FOR EACH loProcess in loProcesses
  IF LOWER(loProcess.Name) = lcExe
     IF loProcess.Terminate() = 0
        RETURN .T.
     ENDIF
  ENDIF
ENDFOR

RETURN .F.
Note you need proper rights on the remote machine to be able to kill the process there, so you need to use an account that is either an admin domain account or an admin account that exists on both machines.

+++ Rick ---


>Is there a way to kill a process that is running remotely? it is a remote server that wasn't closed and is still running because of a program failure.
>
>Thanks
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform