Re: How can I kill a stuck cmd.exe remotely?



You would want to use the Win32_process.Terminate method, the class resides
in the root\cimv2 namespace.

sample script code...

set svc = getObject("winmgmts:root\cimv2")
set objEnum = svc.ExecQuery("Select * from win32_process where caption =
'calc.exe'")
for each obj in objEnum
obj.Terminate(1)
next

WMI is available for NT4 but has to be installed separately, I believe that
it is a part of the NT4 SP4 installation media. If not, you can download it
from this location.

http://www.microsoft.com/downloads/details.aspx?FamilyID=afe41f46-e213-4cbf-9c5b-fbf236e0e875&displaylang=en

--
Scott McNairy
Microsoft MVP - Windows Server Management Infrastructure


"cschang" <cschang@xxxxxxxxxxxx> wrote in message
news:113sgi458u3m52b@xxxxxxxxxxxxxxxxxxxxx
> On my NT 4 server with sp6, I set up a scheduled task to run a cmd job
> regularly, which includes a bunch of commands and exe files. Sometimes,
> the cmd would stuck for some reasons I did not know. The only solution I
> did was to using the task manager to kill that cmd process locally. I want
> to know how I can set a process (using the WSHost script) to kill that
> cmd remotely from my Windows 2000 station. I have that killProc.vbs
> locally. How can I set up so that the script file will connect to that NT
> 4 server and kill the stuck cmd. Does the NT 4 server need to install
> something in order to run the WMI thing? Or the WMI process is not
> available on NT platform? Thanks.
>
> C Chang


.



Relevant Pages

  • RE: Does WMI have to be installed on Remote Computer?
    ... IMHO this looks like a well constructed and very vell commented script. ... WMI comes as standard on w2k w2k3 and xp, ... does WMI need to be installed on the remote computer in order for a ... ''' First try to ping the server. ...
    (microsoft.public.scripting.vbscript)
  • Does WMI have to be installed on Remote Computer?
    ... I'm new to WMI, learning as I go. ... does WMI need to be installed on the remote computer in order for a ... script which uses WMI to work? ... ''' First try to ping the server. ...
    (microsoft.public.scripting.vbscript)
  • Re: Error on 64 bit systems...
    ... Try logging on to the 64-bit system and running the script from that system against itself and against other servers. ... At this point, we're not seeing any errors that would indicate breakage in WMI or an odd configuration, so the problem is apparently rather well-hidden. ... Running the code on the 64-bit server will fill in the picture. ... If it runs ok locally but doesn't run against the remote systems, there's a symmetric problem - likely something with the credentials being used. ...
    (microsoft.public.scripting.vbscript)
  • Re: change local admin password on remote computers
    ... Start tthe script remotely on the server, let it eg. mail the results. ... Or place the script on the remote machine, start it over WMI and let the ...
    (microsoft.public.scripting.vbscript)
  • Use system to start a server then execute commands on it
    ... I have a script set up that allows me to execute a seperate process ... `some cmd on perforce server`; ... The problem is `some cmd` reacts as if the original system call had not ... terminal and sleep between the calls I can see that the perforce server ...
    (comp.lang.perl.misc)