[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need to kill the procexp64.exe

Posted on 2012-09-13
30
Medium Priority
?
1,447 Views
Last Modified: 2012-09-17
People leave the process running and I like to schedule to kill it every night.  I know its very easy with SysInternals, would be "pskill procexp".  How can I script it for all the server in one script and put that script into the schedule.
0
Comment
Question by:Tiras25
  • 17
  • 7
  • 4
28 Comments
 
LVL 84

Accepted Solution

by:
David Johnson, CD, MVP earned 1008 total points
ID: 38397228
create 2 files a list of the servers
and this batch file

for %i in (c:\path\server.txt) do pskill \\%i procexp

set this batchfile to run in task scheduler.
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38397248
The listservers.txt should I just put hostnames each in every line?
0
 
LVL 84

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 1008 total points
ID: 38397275
yes the hostnames 1 per line
0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
LVL 17

Author Comment

by:Tiras25
ID: 38397281
I am using procexp64 so I put
[for %i in (C:\path\server.txt) do pskill \\%i procexp64]
Still not killing for some reason..
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38397293
Make sure that the default admin$ share is enabled on C:\path\server.txt.
hmmm
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38397310
it tells me same on every system even though the Admin$ is enabled.
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38397324
removed \\%i and works now from the command like but not as batch.   weird!
0
 
LVL 84

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 1008 total points
ID: 38397352
sorry as a batch you need to change %i to %%i
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38397360
like this?

for %%i in (C:\path\server.txt) do pskill \\%%i procexp64

pause
0
 
LVL 84

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 1008 total points
ID: 38397382
should have been more explicit only the 2nd one
for %i in (C:\path\server.txt) do pskill \\%%i procexp64
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38397390
not working :-((
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38397442
If you have any idea on how to troubleshoot here let me know.
0
 
LVL 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 992 total points
ID: 38403802
Try adding /f in the for command, like this:

for /f %%i in (server.txt) do echo pskill \\%%i procexp64.exe

Open in new window

See sample output below, note that I added an echo so the pskill command is just echoed:

C:\Temp>type server.txt
server1
server2
server3

C:\Temp>type script.cmd
for /f %%i in (server.txt) do echo pskill \\%%i procexp64.exe
C:\Temp>script

C:\Temp>for /F %i in (server.txt) do echo pskill \\%i procexp64.exe

C:\Temp>echo pskill \\server1 procexp64.exe
pskill \\server1 procexp64.exe

C:\Temp>echo pskill \\server2 procexp64.exe
pskill \\server2 procexp64.exe

C:\Temp>echo pskill \\server3 procexp64.exe
pskill \\server3 procexp64.exe

C:\Temp>
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38406834
Still not killing even from the command line.  
When I do like this its working. But not from \\servername procexp64.  Weird.
C:\Procexp>pskill procexp64

PsKill v1.13 - Terminates processes on local or remote systems
Copyright (C) 1999-2009  Mark Russinovich
Sysinternals - www.sysinternals.com

Process procexp64 killed.
0
 
LVL 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 992 total points
ID: 38406862
You do have access to the remote server, right? Can you try pslist instead?

Try specifying pskill with -u and -p parameters (username / password), like this:

pskill \\server -u <username> -p <password> procexp64

When you say that it is not working: post the error you get, that may help us.
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38406953
Yes, I have Admin privileges and access to the server.  pslist:

C:\Procexp>pslist \\server1

pslist v1.29 - Sysinternals PsList
Copyright (C) 2000-2009 Mark Russinovich
Sysinternals

Cannot connect to remote registry on server1
Access is denied.
Failed to take process snapshot on server1.
Make sure that the Remote Registry service is running on the remote system, that
 you havefirewall ports allow RPC access, and your account has read access the f
ollowing key on the remote system:
HKLM\Software\Microsoft\Windows NT\CurrentVersion\Perflib

**Server name edited out per OP request.**-JARmod101
0
 
LVL 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 992 total points
ID: 38406979
Try adding username and password, like this:

pslist \\server -u <username> -p <password>

Can you map a drive to the server using username/password to an admin share?
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38407027
same thing...  The account  I am using has domain admin privileges.
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 38407058
Drive mapping not working either?
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38407109
I think there is an issue with local shares.  
When i go \\server1 from the same server1 it promts me for the logins.  If I do from \\server2 from server1 it works file. Same as vice versa for other shares.  That could be an issue.
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 38407462
Yes, this is most likely the issue, I already concluded that the script itself was working just fine.
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38407485
Yes, let me address that portion.

C:\Procexp>pskill \\server1 procexp64

PsKill v1.13 - Terminates processes on local or remote systems
Copyright (C) 1999-2009  Mark Russinovich
Sysinternals - www.sysinternals.com

Process procexp64 killed on server1.

So it works from the command line.  It doesn't work inside the script though.
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 38407526
From server1 to server1? Then you dont need \\server1, just pskill procexp64 - can you test that (on server1)?
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38407534
No from server1 to other servers.

=============================================
for /f %%i in (servers.txt) do echo pskill \\%%i procexp64

pause
==============================================
0
 
LVL 38

Assisted Solution

by:Gerwin Jansen, EE MVE
Gerwin Jansen, EE MVE earned 992 total points
ID: 38407554
You did remove the echo above, right :D
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38407661
Yes perfect works now.  Just need to find out why doesn't work on the same machine..
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38407739
One more question.  How can I make it run on the background?  So users do not see it when its scheduled?
0
 
LVL 17

Author Comment

by:Tiras25
ID: 38407783
Nevermind there is an option Hidden in the Task Manager in Windows 2008 Server.   That should take care I assume.
Thanks!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Resolving an irritating Remote Desktop connection that stops your saved credentials from being used.
Article by: Shawn
IT teams define success as solving problems quickly. To enable ITSM modernization we have to think of adopting the tools and methods that will enable resolution of ITSM issues more quickly.
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question