Home All Groups Group Topic Archive Search About

kill a proccess for a specific user

Author
13 Oct 2005 10:10 PM
Johnfli
I have a W2003 Server machine.
I need to have a little program that when runs, it will kill a specific
process from a specific user.    The reason being is that a software company
that run our logistics from, wrote a bad piece of software and when it runs,
it doesn't kill itself when finished.   So after about 2 days, there are
about 100 of this items running.   I want to write a program that I can run,
and it will kill all the instances of this process for me.

Thank

Author
13 Oct 2005 10:33 PM
DanS
Show quote Hide quote
"Johnfli" <j***@ivhs.us> wrote in
news:OFz6cLE0FHA.1256@TK2MSFTNGP09.phx.gbl:

> I have a W2003 Server machine.
> I need to have a little program that when runs, it will kill a
> specific process from a specific user.    The reason being is that a
> software company that run our logistics from, wrote a bad piece of
> software and when it runs, it doesn't kill itself when finished.   So
> after about 2 days, there are about 100 of this items running.   I
> want to write a program that I can run, and it will kill all the
> instances of this process for me.
>
> Thank
>
>
>

FWIW, it's it's the other companies responsibility to fix THEIR bad piece
of s/w.
Author
13 Oct 2005 10:38 PM
Johnfli
you sure aren't kidding.    You have no idea how much I can't stand this
company.   The thing that bites, is that we don't have much choice.   There
aren't to many companies that write teh type of software we need to be able
to run ours.   If I knew of a software company that was local, and had some
itelligent people, I would have them custom write our entire package.   It
would take a few months, but I would think it would be better than the crap
we have now.



Show quoteHide quote
"DanS" <t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a..n.e.t> wrote in message
news:Xns96EEBD9872D80idispcom@216.196.97.142...
> "Johnfli" <j***@ivhs.us> wrote in
> news:OFz6cLE0FHA.1256@TK2MSFTNGP09.phx.gbl:
>
> > I have a W2003 Server machine.
> > I need to have a little program that when runs, it will kill a
> > specific process from a specific user.    The reason being is that a
> > software company that run our logistics from, wrote a bad piece of
> > software and when it runs, it doesn't kill itself when finished.   So
> > after about 2 days, there are about 100 of this items running.   I
> > want to write a program that I can run, and it will kill all the
> > instances of this process for me.
> >
> > Thank
> >
> >
> >
>
> FWIW, it's it's the other companies responsibility to fix THEIR bad piece
> of s/w.
Author
14 Oct 2005 2:20 AM
Ralph
Show quote Hide quote
"Johnfli" <j***@ivhs.us> wrote in message
news:uS8mzbE0FHA.3152@TK2MSFTNGP10.phx.gbl...
> you sure aren't kidding.    You have no idea how much I can't stand this
> company.   The thing that bites, is that we don't have much choice.
There
> aren't to many companies that write teh type of software we need to be
able
> to run ours.   If I knew of a software company that was local, and had
some
> itelligent people, I would have them custom write our entire package.   It
> would take a few months, but I would think it would be better than the
crap
> we have now.
>
>
>
> "DanS" <t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a..n.e.t> wrote in message
> news:Xns96EEBD9872D80idispcom@216.196.97.142...
> > "Johnfli" <j***@ivhs.us> wrote in
> > news:OFz6cLE0FHA.1256@TK2MSFTNGP09.phx.gbl:
> >
> > > I have a W2003 Server machine.
> > > I need to have a little program that when runs, it will kill a
> > > specific process from a specific user.    The reason being is that a
> > > software company that run our logistics from, wrote a bad piece of
> > > software and when it runs, it doesn't kill itself when finished.   So
> > > after about 2 days, there are about 100 of this items running.   I
> > > want to write a program that I can run, and it will kill all the
> > > instances of this process for me.
> > >
> > > Thank
> > >
> > >
> > >
> >
> > FWIW, it's it's the other companies responsibility to fix THEIR bad
piece
> > of s/w.
>

As you don't need to do this from a particular program why not just use a
command line utility, that you could run from an Administrative script or
batch file...
http://www.sysinternals.com/Utilities/PsKill.html

(Incidently this site has some great tools, that should be part of your
toolkit.)

-ralph
Author
14 Oct 2005 4:42 AM
Someone
Beware that pskill utility will kill all processes that matches the EXE name
for all logged on users if you are a member of the Administrator group. This
can be a problem if you are using a terminal server. It's a "feature" that
can't be turned off in pskill. If you use pskill, run it as a regular user.
Type "runas" in Command Prompt to see how to use it in a batch file, or
create a shortcut and change its advanced options to run as a different
user.


Show quoteHide quote
"Ralph" <nt_consultin***@yahoo.com> wrote in message
news:1KOdnW4cbfVTiNLeRVn-iQ@arkansas.net...
>
> "Johnfli" <j***@ivhs.us> wrote in message
> news:uS8mzbE0FHA.3152@TK2MSFTNGP10.phx.gbl...
>> you sure aren't kidding.    You have no idea how much I can't stand this
>> company.   The thing that bites, is that we don't have much choice.
> There
>> aren't to many companies that write teh type of software we need to be
> able
>> to run ours.   If I knew of a software company that was local, and had
> some
>> itelligent people, I would have them custom write our entire package.
>> It
>> would take a few months, but I would think it would be better than the
> crap
>> we have now.
>>
>>
>>
>> "DanS" <t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a..n.e.t> wrote in message
>> news:Xns96EEBD9872D80idispcom@216.196.97.142...
>> > "Johnfli" <j***@ivhs.us> wrote in
>> > news:OFz6cLE0FHA.1256@TK2MSFTNGP09.phx.gbl:
>> >
>> > > I have a W2003 Server machine.
>> > > I need to have a little program that when runs, it will kill a
>> > > specific process from a specific user.    The reason being is that a
>> > > software company that run our logistics from, wrote a bad piece of
>> > > software and when it runs, it doesn't kill itself when finished.   So
>> > > after about 2 days, there are about 100 of this items running.   I
>> > > want to write a program that I can run, and it will kill all the
>> > > instances of this process for me.
>> > >
>> > > Thank
>> > >
>> > >
>> > >
>> >
>> > FWIW, it's it's the other companies responsibility to fix THEIR bad
> piece
>> > of s/w.
>>
>
> As you don't need to do this from a particular program why not just use a
> command line utility, that you could run from an Administrative script or
> batch file...
> http://www.sysinternals.com/Utilities/PsKill.html
>
> (Incidently this site has some great tools, that should be part of your
> toolkit.)
>
> -ralph
>
>
Author
14 Oct 2005 11:10 AM
Mark Yudkin
Use the TerminateProcess API. To find the process handle, use OpenProcess
with the process id, requesting PROCESS_TERMINATE access.

To retrieve the list of process id's for the process (whose name you
obviously know), there are range of options. The most obvious is probably to
use EnumProcesses, then for each of the returned processes use OpenProcess
requesting PROCESS_QUERY_INFORMATION and PROCESS_VM_READ and call
GetModuleBaseName (or related PSAPI API) You can then call TerminateProcess
as desired. An alternative is to call CreateToolhelp32Snapshot, followed by
Process32First and Process32Next.

To kill a process not belonging to yourself, you'll need TCB privilege
(SE_TCB_NAME), which you'll have to map into your token by using
AdjustTokenPrivileges for the relevant LUID.

Show quoteHide quote
"Johnfli" <j***@ivhs.us> wrote in message
news:OFz6cLE0FHA.1256@TK2MSFTNGP09.phx.gbl...
>I have a W2003 Server machine.
> I need to have a little program that when runs, it will kill a specific
> process from a specific user.    The reason being is that a software
> company
> that run our logistics from, wrote a bad piece of software and when it
> runs,
> it doesn't kill itself when finished.   So after about 2 days, there are
> about 100 of this items running.   I want to write a program that I can
> run,
> and it will kill all the instances of this process for me.
>
> Thank
>
>
Author
14 Oct 2005 4:30 PM
Mike Williams
"Johnfli" <j***@ivhs.us> wrote in message
news:OFz6cLE0FHA.1256@TK2MSFTNGP09.phx.gbl...

> I need to have a little program that when runs, it will kill a
> specific process from a specific user.

Now there's a coincidence. The other day I was looking for a little program
that would kill a specific user and leave the process running ;-)

Mike
Author
14 Oct 2005 6:15 PM
Johnfli
oh, there are several users I'd like to kill, but I'd go to jail.   I don't
think the judge would let me use the; "But your Honor, the world is a better
place now, honest!"



Show quoteHide quote
"Mike Williams" <M***@WhiskyAndCoke.com> wrote in message
news:diomf4$gpd$1@news6.svr.pol.co.uk...
> "Johnfli" <j***@ivhs.us> wrote in message
> news:OFz6cLE0FHA.1256@TK2MSFTNGP09.phx.gbl...
>
> > I need to have a little program that when runs, it will kill a
> > specific process from a specific user.
>
> Now there's a coincidence. The other day I was looking for a little
program
> that would kill a specific user and leave the process running ;-)
>
> Mike
>
>
>
>