Taskkill not working right in Server 2003 Getting an error

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Acy Forsythe
Posts: 126
Joined: 10 Jun 2011 10:30

Taskkill not working right in Server 2003 Getting an error

#1 Post by Acy Forsythe » 30 Oct 2013 08:57

So I've got this batch script that has been working forever. There is a large monitor displaying a power point presentation. I've got a few night time clerical folks who update the power point with new info on a regular basis and the batch file is to take away the technical aspect for them. All they do is open the file, update and save it and they are done.

The batch file routinely runs a few times a day and it kills the current running copy of PPTView.exe and then opens a new instance of the app grabbing the newly updated file.

Code: Select all

@ECHO OFF

TASKKILL /F /IM PPTVIEW.EXE

start "C:\Program Files\Microsoft Office\Office14\pptview" "D:\PRESENTATION.pptx" /MAX

exit /b



It's not overly complex and it's been working fine for over a year. Now, if I try to run that command even from a command prompt logged in as administrator, I get the following error:

ERROR: Cannot start a new logon session with an ID that is already in use.

This started happening roughly a month or so ago and I'm not the only admin here so I'm not 100% sure that nothing has changed, but I can't seem to find an answer online. I've been googling for hours and I've found a few close articles but nothing seems to match what's happening here and none of the "fixes" apply to me or even work when I've tried them.

Any help here would be greatly appreciated.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Taskkill not working right in Server 2003 Getting an err

#2 Post by foxidrive » 30 Oct 2013 11:29

Add the two double quotes shown below. if that doesn't change the error, rename the batch file to a different name and try it.

@ECHO OFF
TASKKILL /F /IM PPTVIEW.EXE
start "" "C:\Program Files\Microsoft Office\Office14\pptview" "D:\PRESENTATION.pptx" /MAX
exit /b

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Taskkill not working right in Server 2003 Getting an err

#3 Post by foxidrive » 30 Oct 2013 11:32

Are you saying that you get the error when you type the taskkill command?

Check for another taskkill.* on the path or the current folder.

Acy Forsythe
Posts: 126
Joined: 10 Jun 2011 10:30

Re: Taskkill not working right in Server 2003 Getting an err

#4 Post by Acy Forsythe » 30 Oct 2013 13:13

foxidrive wrote:Add the two double quotes shown below. if that doesn't change the error, rename the batch file to a different name and try it.

@ECHO OFF
TASKKILL /F /IM PPTVIEW.EXE
start "" "C:\Program Files\Microsoft Office\Office14\pptview" "D:\PRESENTATION.pptx" /MAX
exit /b


The second line works fine every time, which is how I noticed the error. The server almost crashed with about 60 of the power point viewer instances running.

foxidrive wrote:Are you saying that you get the error when you type the taskkill command?

Check for another taskkill.* on the path or the current folder.


Yes, but ONLY if I try to kill a process (even tried with a blank notepad).

If I open a command window and type:

TASKKILL /?

It will work and will display help for the command. If I then type (even from a command prompt):

TASKKILL /F /IM PPTVIEW.EXE

It fails with the above error.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Taskkill not working right in Server 2003 Getting an err

#5 Post by foxidrive » 30 Oct 2013 14:19

Acy Forsythe wrote:The second line works fine every time, which is how I noticed the error. The server almost crashed with about 60 of the power point viewer instances running.


That's can be so, but it is running from association and not executing the EXE directly. Without the leading "" it will use the first quoted term as a window title.

foxidrive wrote:Are you saying that you get the error when you type the taskkill command?

Check for another taskkill.* on the path or the current folder.


Yes, but ONLY if I try to kill a process (even tried with a blank notepad).

If I open a command window and type:

TASKKILL /?

It will work and will display help for the command. If I then type (even from a command prompt):

TASKKILL /F /IM PPTVIEW.EXE

It fails with the above error.


You may have another taskkill.* in the system, even a batch file which is earlier on the path and may be involved.

CD to c:\windows\system32 and do DIR taskkill* to ensure there is only one file, and then try the command line above.
If it still fails then check the properties of the taskkill.exe and ensure it is for your version of Windows.

If it is - try it again with another copy of taskkill.exe from a similar machine in a different folder.

Acy Forsythe
Posts: 126
Joined: 10 Jun 2011 10:30

Re: Taskkill not working right in Server 2003 Getting an err

#6 Post by Acy Forsythe » 30 Oct 2013 14:56

I'll give that a shot Foxdrive just for process of elimination, but everything was actually working fine until a month ago.

Acy Forsythe
Posts: 126
Joined: 10 Jun 2011 10:30

Re: Taskkill not working right in Server 2003 Getting an err

#7 Post by Acy Forsythe » 04 Nov 2013 16:38

There is nothing on the path that would conflict with Taskkill.exe

And again, Taskkill /? works fine.

This is very frustrating because it was working fine for over a year and now the command has suddenly stopped and I think it may be due to an update or something, but I can't seem to find anything online that would help me.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Taskkill not working right in Server 2003 Getting an err

#8 Post by foxidrive » 04 Nov 2013 16:53

Do you get this error message in the console window or in a popup?

Is there any entry in the event logs?



These two items may be relevant.

http://community.spiceworks.com/topic/9 ... -scripting
http://support.microsoft.com/kb/2283089

Acy Forsythe
Posts: 126
Joined: 10 Jun 2011 10:30

Re: Taskkill not working right in Server 2003 Getting an err

#9 Post by Acy Forsythe » 05 Nov 2013 16:01

It displays in the console, and I could not find an eventlog that had anything to do with the problem I am having or a similar error. That was one of the first places I looked.

And yeah those two links were easily in the first 5 I visited looking for a solution. I find lots of similar issues, but none of the solutions fix my problem.

I bypassed it though. Not what I REALLY wanted to do but here is what I did:


I installed Powershell on the server and then changed:

TASKKILL /F /IM PPTVIEW.EXE

To:

Powershell Stop-Process -Name PPTVIEW


So yeah my batch file has now been bastardized and anyone following behind me will scratch their heads wondering why I didn't just do it all in a powershell script.

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Taskkill not working right in Server 2003 Getting an err

#10 Post by foxidrive » 05 Nov 2013 16:24

This fellow seemed to have solved that issue which was related to clock drift in his case.

http://www.networksteve.com/forum/topic ... 54&Posts=2

After additional troubleshooting this issue I'd say I've found the root cause of the problem. The hardware clock frequency on this server (which is a DC) has an error and the clock drifts quite a lot. The Windows Time service cannot take the clock drift into account (it can only correct system time by discontinuous changes). So, the system time is corrected by a scheduled task that runs every 4 minutes and synchronizes the clock with another DC. It seems that despite of the synchronization the system time of the server occasionally differs too much and exceeds the maximum tolerance for computer clock synchronization of the Kerberos protocol. In the Default Domain Policy GPO I changed the following setting: Computer Configuration -> Windows Settings -> Security Settings -> Account Policies -> Kerberos Policy -> Maximum tolerance for computer clock synchronization -> increased from 5 to 7 minutes After that change the services which run as the "NT AUTHORITY\NetworkService" account on the server have not experienced the problems mentioned in my initial post for last 3 weeks. I'd say the issue has been fixed. -- rpr.

Post Reply