I am trying to execute a simple remote script (beenhere.wsf example). It
works fine but the local script that starts the remote script does not quit
immediately. It takes a long time (around 5 minutes) to get the command
prompt back. Inside a debugger also, I cannot break into the process or
anything. Any clue?
System configuration:
Local: WinXP Pro SP1 (WSH5.6)
Remote: Win2003/Win2k Server/WinXP Pro SP1 (no difference)
Here is the local script:
----------------------------
Dim Controller, RemoteScript
Set Controller = WScript.CreateObject("WSHController")
Set RemoteScript = Controller.CreateScript("c:\beenhere.wsf", "\\MYSERVER" )
WScript.ConnectObject RemoteScript, "RemoteScript_"
RemoteScript.Execute
Do While RemoteScript.Status <> 2
WScript.Sleep 100
Loop
WScript.DisconnectObject RemoteScript
msgbox "Finished..."
WScript.Quit
[ event handling code omitted - they just display messages]
The contents of "beenhere.wsf" is:
--------------------------------------
<package>
<job>
<script language="VBScript">
set fso = CreateObject("Scripting.FileSystemObject")
set fout = fso.CreateTextFile("c:\beenhere.txt", true)
fout.WriteLine Now
fout.Close
</script>
</job>
</package>
Thanks very much in advance for your help.
-- Avijit
1. It works fine with wscript.exe but the problem is when I run it using
CScript.exe
2. These scripts run ok in other XP systems. If I need to fix my WSH
installation how to do that?
My CScript.exe version: 5.6.8515
Thanks,
Avijit
"Avijit" <msdn-u...@wildpackets.com> wrote in message
news:O7gETu3h...@TK2MSFTNGP09.phx.gbl...
If you didn't call "DisconnectObject", will it return right away?
Luke
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Not calling "DisconnectObject" has the same effect i.e., it still waits for
about 5 minutes.
Thanks,
Avijit
"MSFT" <luke...@online.microsoft.com> wrote in message
news:QgaADZ%23hDH...@cpmsftngxa06.phx.gbl...
Do While RemoteScript.Status <> 2
WScript.Sleep 100
Loop
Luke
Making the change as you suggested also didn't work. I also tested with
JScript and found the same behavior. Here is the JScript code I used:
var oController = WScript.CreateObject("WSHController");
var oProcess = oController.CreateScript("c:\\remote-test\\beenhere.wsf",
"ac-test-winxp");
oProcess.Execute();
do {
WScript.Sleep(100);
} while ( oProcess.Status != 2 );
WScript.Echo("Done");
The "beenhere.wsf" remains the same VBScript code.
Also, I am not sure what you meant by "You may test to run script on local
computer". If you meant running "beenhere.wsf" locally, then the answer is
yes - I tired it. beenhere.wsf exits immediately after creating the file
"C:\beenhere.txt" as expected.
-- Avijit
"MSFT" <luke...@online.microsoft.com> wrote in message
news:2H1ElgMi...@cpmsftngxa06.phx.gbl...
Sub Remote_Start
Wscript.Echo "Started"
End Sub
Sub Remote_End
Wscript.Echo "Finished"
End Sub
Basically I want to see if the remote script finishes immediately or after
5 minutes.
Mike Dutra
Microsoft Developer Support WSH/WMI/Cluster Dev
Disclaimer: This posting is provided "AS IS" with no warranties, and
confers no rights. You assume all risk for your use.
I also tried to attach the Visual Studio (7.01) debugger with the
cscript.exe process and it attaches ok. However, when I try to break, I get
an error message: "Unable to break execution. The process does not contain
any programs."
Thanks,
Avijit
"Mike Dutra" <mdu...@online.microsoft.com> wrote in message
news:bnXviVDj...@cpmsftngxa06.phx.gbl...
Also, this only occurs on one XP machine? You could try reinstalling WSH on
that machine from the http://msdn.microsot.com/scripting site.
Basically it sounds like WSH is waiting on something to finish. It may be
that something is timing out or it may actually be finishing. The only way
I know of to determine what that something is would be to get a user dump
of the cscript process during the hang. From that we can find out at least
what type of item WSH is waiting on (thread, port, process, etc). You may
want to call in and create a case as I can think of nothing off hand that
would cause this. In all other issues like this there was an object created
that was the culprit. In this case there are not really any objects other
than the WshRemote object. In all cases I needed a process dump to
determine the hang.
I can send you a user dump. Could you please let me know how to do that?
Thanks,
Avijit
"Mike Dutra" <mdu...@online.microsoft.com> wrote in message
news:37QBO7Sj...@cpmsftngxa06.phx.gbl...
Once you download and install then open windbg.
Goto File and Attach to a process and select cscript.exe (or wscript.exe,
which ever is loaded)
Once broken in you need to go to the command window and type in the
following command:
dump /mfh c:\script.dmp
I am not sure how big it will be so you may need to zip it up.
I opened the Command window and the status bar says "Debugee not connected".
Therefore I am unable to get the dump.
Please let me know what would be the next step.
Thanks,
Avijit
"Mike Dutra" <mdu...@online.microsoft.com> wrote in message
news:uWh1FUcj...@cpmsftngxa06.phx.gbl...
Thanks,
Avijit
"Mike Dutra" <mdu...@online.microsoft.com> wrote in message
news:B9XsQPpj...@cpmsftngxa06.phx.gbl...
Thanks,
Avijit
"Mike Dutra" <mdu...@online.microsoft.com> wrote in message
news:973bn3Yk...@cpmsftngxa06.phx.gbl...