WindowsShutdown Conflict error

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

WindowsShutdown Conflict error

Post by Bob Hansen » Wed Mar 26, 2003 10:32 pm

Using 7.2.028, with Win98ME.

I created a Dialog box to logoff from windows to replace the MicroSoft one. I have a shortcut on the Start Menu to call the macro with the Dialog. All works well execpt that I get a sharing conflict with MSSCHED because MS is running in the system tray. :arrow:

It appears that using the Start Menu shortcut opens a second copy of MS and that is causing the conflict. It is necessary to keep MS running because of schedules. If I close the system tray before selecting the shortcut, no error.. If this was for me, I could remember to do that. But this is intended as a one key function for other users. Any solutions on how to eliminate the error message?:?:

:!: How about a command line option to shut down already resident MS?

But how to prevent it from shutting down the 2nd macro that is calling to shutdown the resident MS? Hmmmm. :?:
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu Mar 27, 2003 1:01 am

Hi Bob,

I had mentioned this peculiar issue in my previous post. To terminate the actively running resident Macro Scheduler ("MS") programmatically, you can run a batch file from your shutdown MS script. In the batch, you can include the following Windows (DOS mode) command:
kill msched.exe

Bear in mind, it take several seconds before it's completely removed from Windows as you can notice the "gear" icon dsiappears from the system tray. The filename and syntax of KILL varies in Win98se and WinXP.

Nonetheless, I must highlight that the shutdown> command won't be affected or impeded by the resident Macro Scheduler unless MS is running another MS script at the same time, that is, when the "gear" icon is blinking.

Please keep us posted about your scripting experiences. Thanks.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Thu Mar 27, 2003 1:34 am

Hi Armstrong....thanks for your reply.

You mentioned your earlier posting:
I had mentioned this peculiar issue in my previous post. To terminate the actively running resident Macro Scheduler ("MS") programmatically, you can run a batch file from your shutdown MS script. In the batch, you can include the following Windows (DOS mode) command:
kill msched.exe
I could not find that posting on line, but I seem to remember it was using NT and 2K commands, which I did not have a need for. I did a search for "kill" on Win98SE/ME, but does not have it. I would prefer to use a batch file vs. another application for ease of distribution, so getting this command would be great.:arrow:

If you can locate the "kill" command for Win95 and 98ME/SE that would be great. Or even point me to the date of the posting that explained it will be helpful. :?:

But I had responded to another of your earlier posts and did download the "PowerOff" software.:D I had glanced through the documentation, looked like it had potential, but I never installed and experimented. Guess I'll have to do it now. :lol: That will probably be the final solution.

Still looking for a solution without new software, but don't always get what I want. Will watch for additional suggestions also. :arrow:

Thanks again for your ideas.....will provide results...stay tuned....
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu Mar 27, 2003 5:03 pm

Hi Bob,

kill.exe is included in Windows 98 Resource Kit.

In this (unusual) case, PowerOff and most other similar shareware will fail if Macro Scheduler is running another script such as downloading a huge number of newgroup postings in Outlook Express. I've already done numerous time-consuming experiments before. None of them peforms functionally better than Macro Scheduler's ShutDownWindows> command.

Definitely, you should try out kill.exe (116KB) first. BTW, when writing your script, you usually need tlist.exe to list out the currently active processes if you're interested to "kill" other tasks as well.

Microsoft constantly changes their download policy. I've no idea whether they still offer the Win98 Resource Kit for free. If you need help. I'll email it to you for your "evaluation."

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Thu Mar 27, 2003 5:11 pm

Hi Bob,

The resource kit may be located in \tools\reskit\ of your Windows 98 CD. Please verify. Thanks.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Mar 28, 2003 4:13 am

Good news (2) and bad news (2).

Good news 1. I already had 98 Resource Kit installed,
Bad News 1. But Kill and Tlist not there.

Good News 2: Had 98 Upgrade CD. Resource kit is in \tools\reskit\ folder as noted. Installed, it was newer than previous copy.
Bad News 2. Kill and Tlist not here either.

Here is a list of tools provided:
==============================
Windows 98 Resource Kit Sampler Contents

The Windows 98 Resource Kit Tools Sampler contains the following tools and utilities.

Configuration
CHDOSCP.EXE: MS-DOS Code Page Changer
FAT32WIN: FAT32 Conversion Information Tool
TZEDIT.EXE: Time Zone Utility

Deployment
BATCH.EXE
INFINST.EXE: Windows 98 .INF Installer

Desktop
CHECKLINKS.EXE: Link Check Wizard
CLIPTRAY.EXE: Clipboard Organizer
MINITEL.TTF: Minitel Emulation Files
QUIKTRAY.EXE: System Tray Utility
TWEAKUI: Desktop Power Toy

Diagnostic and Troubleshooting
FILEINFO.EXE: System File Information
USBVIEW.EXE: USB Device Troubleshooter

File
LFNBACK.EXE: Long Filename Backup Utility
TEXTVIEW.EXE: TextViewer
WHERE.EXE: File locating tool
WINDIFF.EXE: File and Directory Comparison

Network Administration
Network Monitor Agent and Protocol Driver
POLEDIT.EXE: System Policy Editor
PWLEDIT.EXE: Password List Editor
REMOTREG: Microsoft Remote Registry Services
RPCPP: Microsoft Remote Procedure Call Print Provider
SNMP Agent: Windows 98 Remote SNMP Service

Scripting
TIMETHIS.EXE: Time This
WAITFOR.EXE
WINSET.EXE: Environment Setting Utility
Windows Scripting Host Documentation/Sample Scripts

Other Documentation
The Windows 98 Resource Kit book online
Overview of Windows 98 Resource Kit Sampler Tools © Microsoft Corporation 1985 - 1998
======================
Perhaps it is compiled into one of the files noted above? :?:


Also have 98ME CD, no folder for resource kit :?:
Also have 98SE CD, has folders, but not those files. :?:
Also have 98SE Upgrade CD has folders, but not those files :?:

I will check MS site for download.....stay tuned....thanks.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Mar 28, 2003 6:20 am

:( According to what I could find on Microsoft pages, Kill.exe and Tlist.exe are utlities that are provided with NT Server Resource kit, not with 98 Resource kits.

:D But I have located a site that has them available for download:
http://www.mattkruse.com/utilities/

:?: Not sure about licensing issues either. The site has a few other utilities. I cannot recommend any of them, I have not used them, I'm just passing on the location.


Won't be able to check out immediately. I don't know if these will work on Win 95/98 SE/ME, but I guess I will find out......:arrow:
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Fri Mar 28, 2003 1:11 pm

Hi Bob,

Kill.exe is definitely a Win98 admin tool because I'm using it daily to "kill" some known ad- and spy-ware.
kill.exe.........116KB
tlist.exe........112KB

For Windows XP, the similar tool is known as taskkill.exe. The following is a part of my daily running Macro Scheduler script to "kiil" all redundant processes:

Let>RP_WINDOWMODE=2
run>c:\Windows\Command\taskkill.exe /FI "IMAGENAME eq ctfmon.exe" /F
run>c:\Windows\Command\taskkill.exe /FI "IMAGENAME eq nopdb.exe" /F
run>c:\Windows\Command\taskkill.exe /FI "IMAGENAME eq Mdm.exe" /F

If you need the two files, please feel free to ask via email. Thanks you for keeping us posted your latest progress.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Fri Mar 28, 2003 1:38 pm

Hi Bob,

Please try:
ftp://ftp.microsoft.com/services/techne ... /diagnose/

Please keep us posted about your latest scripting experiences. Thanks.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Mar 29, 2003 1:21 am

Thanks for the link to the FTP site. I just downloaded them, did a quick check in a DOS window and it looks like they will run OK. Work for the weekend.

I had also downloaded the files from the site that I had located. But it turned out that they were the NT versions, so you have saved me a few more research steps.

I am having a ShutdownWindows>2 problem now that is generating error messages. At first I thought it was because my shortcut to exit was conflicting with the copy alread running in systray. But I have found that I still get the error message even when I have closed the systray copy.

May end up using PowerOff utils after all, but at least I have another option to consider.

Thanks again for the files......stay tuned......
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Sat Mar 29, 2003 1:36 am

Bob,

Glad that you have some progress.
1. Why ShutDownWindows>2, instead of ShutDownWindows>0, is used?
2. If Msched.exe is killed, how could we logically expect ShutDownWindows remains functional? It could if you have compiled the MS script and run the EXE version.

Happy scripting.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Mar 30, 2003 4:29 pm

Hello Armstrong......you asked the following:
1. Why ShutDownWindows>2, instead of ShutDownWindows>0, is used?
I want to Log Off at the workstation, not to Shut Down. This unit has shared resources to be used by others, and must stay on line.
2. If Msched.exe is killed, how could we logically expect ShutDownWindows remains functional?
Excellent question!
It does do it under some circumstances. and I think this is a clue to to the error.
I apologize for the length of the following, but think it will be useful.
===========================
Original environment of problem was to have MS running in the systray. Clicking on a shortcut icon to run a macro to Log Off using ShutDownWindows>2. Clicking on that icon at times was causing a Access Conflict error. But I found that the error did not always happen.

Using KILL and TLIST utilities (Thank you very much! :D ), I created the following script to remove any copies of MS already running before executing ShutDownWindows>2 command.
The script redirects the output of TLIST to a file. FIND is then used to find lines of MS to get the PID for use with KILL. KILL is then executed and the routine loops until no more copies of MS are found. Then it goes to ShutDownWindows. (There is also a quick test option at the top to just repeatedly try to log off as test conditions are changed).

Following this script are some notes about using the script and my observations and conclusions.
=========================
Label>Purpose of MSKILL script
//This is to avoid the error message that occurs when selecting a
//shortcut icon to ShutDownWindows>. If Macro Scheduler (MS)is already
//running in the system tray, a conflict error message sometimes comes up
//Need to use KILL.EXE to close earlier running copies of MS (PID changes every time)

Label>Skip
//Activate next line to skip Kill routine and try to Log Off immediately
//GoTo>Close

Label>Start
Let>RP_WINDOWMODE=0
Let>Killed=0
//NoKill is size of empty kill.txt file
Let>NoKill=24
Add>NoKill,1
Change Directory>C:\temp
Label>Kill
//Start Kill Loop
DeleteFile>alive.txt
DeleteFile>kill.txt
//Redirect tlist output to file
Run Program>command.com /c c:\windows\command\tlist.exe > alive.txt
Wait>2

//Read line that has Macro Scheduler
Run Program>command.com /c c:\windows\command\find.exe "Macro Scheduler" alive.txt>kill.txt
Wait>5

//Macro Scheduler is closed if killsize=nokill, process is done
FileSize>kill.txt,killsize
If>%killsize%kill.txt,3,killme
Pos>MS,%killme%,1,PIDend
Sub>PIDend,1
MidStr>%killme%,1,%PIDend%,PID

//Run KILL /f for that PID
Run Program>command.com /c c:\windows\command\kill.exe /f %PID%
Wait>2
Add>Killed,1
Message>Just killed a copy of MS.%CRLF%%CRLF%Killed %Killed% so far.
Wait>5
//End Kill Loop
//Check for more MS running copies
Goto>Kill

Label>Dead
Message>Other copies of MS are not loaded%CRLF%%CRLF%Total of %Killed% were closed.
Wait>10

Label>Continue to ShutDownWindows>
Label>Close
ShutDownWindows>2
===============================
Steps to reproduce tools analysis:

1. Make a desktop shortcut for this MSKILL script
2. Close all copies of MS
3. Open 1 copy of MS to see icon in systray
4. Open a Command Window and run tlist.exe to see 1 copy of MS with title of Macro Scheduler.
5. Double click on desktop icon to remove already running MS copies
6. Note another copy is shown in systray, ond flashing.
7. When done, see message that a total of 1 copy was closed (that was the original). See one icon in systray, not blinking. Message will go away.
8. In the Command Window run tlist.exe to see 1 copies.of MSCHED with title of "OleMainThreadWndName".
9. After a few moments final MS icons will go away from systray.
10 In the Command Window run tlist.exe to see 0 copies.of MSCHED


Repeat steps 2-10 above, but open 3 copies of MS in step 3 vs. 1 copy. Step 4 will show 3 copies. Three messages will come up as each copy is killed. Icons are not removed in systray until entire process has been completed.

======== COMMENTS ===========

The fact that the final message came up after KILLing MS would seem to indicate that the running script is in a memory location separate from the main MS program. It continues to process somehow even though MS has been removed?

If close all copies of MS (vs. having one copy running) and run from icon, then macro does not complete which means that at least one copy of MS must be running to do ShutDownWindows>2.

TLIST provides a method to see "title" about the running tasks.
If no MS copies are already running, do get error message with SDW>2.
If one copy is runnning get no error message, unless "Macro Scheduler" has changed to "OleMainThreadWndName". What makes that change names? There also seems to be no external indication of the "title" change.

It looks like if MS is already running the second copy is given the name "OleMainThreadWndName".

If MS is running = get error
If MS not running = no error

If MS running, KillMS Script = no error
OleMainThreadWndName, Kill Script = error

Doing various activitiies with one copy of MS in systray, and runnning TLIST. I have been able to make the title change from "Macro Scheduler" to "OleMainThreadWndName", but haven't figured out the logic yet. I'm getting an area that I am not familiar with and hope that Marcus can use this to help solve the problem.

My conclusion at this point:
Error problem is not consistent, but it only seems to happen if there is no MS running with the title "Macro Scheduler", but a copy running with the title "OleMainThreadWndName".

Thanks for all the help so far.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Wed Apr 02, 2003 1:48 am

Hello Bob,

I'm sorry for not being able to reply your post earlier as we have been taking maximum caution against SARS in Hong Kong (http://www.cnn.com/2003/HEALTH/04/01/hk.sars/index.html). Thanks for your painstaking effort in expounding the technical issue you're being tormented. Your script may attract more interesting questions:
1. Your observation hints some timing issue. Windows allows multiple processes. In your scenario, definitive procedural sequence must be properly maintain by Let>RP_wait=1.
2. Run Program>command.com /c c:\windows\command\find.exe /I "Macro Scheduler" alive.txt>kill.txt
The parameter /I could help ignore cases. Find.exe is a case-sensitve command.
3. "Killing" Msched.exe takes unusually more time (even for 2GHz+ Pentium 4). It even takes much longer for the "gear" icon to vanish from the systray.
4. Asssuming Msched.exe presents itself as "Macro Scheduler" in your kill.txt (on Win98), why not simply and more directly run:
Run>command.com /c c:\windows\command\kill.exe /f msched.exe.

Please keep us posted your latest progress. Thanks.

Happy scripting.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Apr 06, 2003 9:50 pm

I have allowed this to get off track. The discussions have evolved into trying to kill Macro Scheduler, and we should not have to do that. Macro Scheduler should not be having the error message.

The discussion evolved because of my obeservation that when using Tlist, I could see Macro Scheduler loaded under two names: "Macro Scheduler" and "OleMainThreadWndName". The error seemed to occur more often when the name was
========================================

Restating the problem to be resolved:

Using 7.2.029, Windows 98SE and Windows 98ME,
Simple one line macro,
ShutDownWindows>2
to log off, run from a desktop icon, intermittently gives an error re conflict. (Message has been too fast, or me too slow, to properly record full content). Resource meter also shows less resources resources available when logoff/login is completed. Losing about 3% per cycle, some type of memory leak?.

What is the solution?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sun Apr 06, 2003 10:35 pm

I am going to move/continue this topic in the forum for Macro Scheduler Beta............specific to 7.2 versions
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts