Re: Script hangs, but only one one machine



deetony wrote:
We have a Server W2k3 SP1 with WSH 5.6.
The following test-script hangs for around 15 second at two steps.

Here the test script:

--------------------------------------------------
msgbox("scriptstart")
set objWSHShell = WScript.CreateObject("WScript.Shell")

msgbox("Setze Umgebungsvariable...")
setdbimpvar(0)
msgbox("fertig.")


msgbox("Starte Anwendung (winword)...")
Set objWord = WScript.CreateObject("Word.Application")
set objword = nothing
msgbox("fertig.")


msgbox("Starte wscript.network zum Setzen des Standarddruckers")
Set wshnet = CreateObject("WScript.Network")
wshnet.SetDefaultPrinter "Serviceprinter"
Set wshnet=nothing
msgbox("fertig.")

wscript.quit

Function setdbimpvar(myzahl)
Set WshEnv = objWSHShell.Environment("System")
WshEnv("dbimp") = myzahl
If err.number<>0 Then
err.clear
On Error Resume next
End If
Set WshEnv=nothing
End Function

------------------------------------------------

The script hangs around 15 seconds after "Setze Umgebungsvariable" and another 15 seconds after "Starte wscript.network zum Setzen des Standarddruckers"

The funny thing about it is, that this sript hangs only on this specific machine. On any other it runs fast, so it may not be a matter of the script. We reinstalled WSH 5.6 but it didn't solve the problem. All file versions are up to date.

Does anyone has any idea or suggestion ?

Both of these operations (changing the system default for an
environment variable and changing the default printer) causes
a notification to be sent to each top level window on the machine, so other programs can adapt to the change immediately.

If some other program on that one machine is not processing messages
"in a timely manner" (even if that program has not asked for the notification), your script hangs until the notification times out.
Some Microsoft tools (including the first tab of Task Manager) will label the slow-eating program as "not responding", which may help you find it.

Writing programs to eat unwanted notifications all the time no matter what the program itself is really doing is actually very difficult and thus something not always done.

--
Jakob Bøhm, M.Sc.Eng. * jb@xxxxxxxxxx * direct tel:+45-45-90-25-33
Danware Data A/S * Bregnerodvej 127 * DK-3460 Birkerod * DENMARK
http://www.netop.com * tel:+45-45-90-25-25 * fax:+45-45-90-25-26
Information in this mail is hasty, not binding and may not be right.
Information in this posting may not be the official position of Danware
Data A/S, only the personal opinions of the author.

.



Relevant Pages

  • Re: expect + telnet hangs on AIX
    ... Is it only telnet to a particular host that misbehaves? ... >> This script hangs 80% of the time ... >> When running expect -d it never hangs ... 'close stdout ' ...
    (comp.lang.tcl)
  • Re: ExecQuery hangs whole script but GetObject is fine
    ... Please can you write a small script that attempts this ExecQuery, ... ensure it hangs three times on the rogue machine and works three times ... > executing the query and the query hangs and thus the whole script ... > of the DCs as a domain admin but in the scheduled task that the script ...
    (microsoft.public.win32.programmer.wmi)
  • Re: T2000 wont shutdown
    ... few scripts later S91afbinit hangs. ... Killing that, and then S91zuluinit hangs. ... last one that's responsible for the script still running. ... Now it won't boot :-( A boot -s doesn't work either, ...
    (comp.unix.solaris)
  • Re: Wont work on some systems
    ... If I run it remotely by specifying the machine name in the script ... I've indicated where it hangs: ... strComputer = WshShell.ExpandEnvironmentStrings ...
    (microsoft.public.scripting.vbscript)
  • Re: ActiveX task hangs in DTS
    ... it hangs when its executed manually and if scheduled. ... the script is simple, see below: ... > Which version of SQL Server and what service pack? ...
    (microsoft.public.sqlserver.dts)