vb script called from login script exits when login script ter

vb script called from login script exits when login script ter

Post by Y2xo » Wed, 03 Oct 2007 22:48:00



That's correct. We have the security policy set to run login scripts
synchronously, but the last thing the actual login script (the script that's
pointed to by the GPO) does is call another script using a wshShell.Run
"R:\Scripts\LoginAsync.vbs", 0, False line. The "False" in this line should
kick off the second script but the first script does NOT wait for the second
script to finish. That part of it works fine. The problem is that when the
first script quits, it closes down the second script even if the second
script hasn't finished running.


Do you mean, is the login screen still black? No, that's the point of it.
The initial login script quits so that the user can get to their Windows
desktop, but we want the 2nd script to still run in the background until it's
finished.


No errors. The 2nd script just quits.


It's a pretty simple script already since I'm just testing this.
Essentially all I'm doing right now is using a For loop to display a message
box every 5 seconds for a total of 10 times.

If I run the first script manually then it kicks off the 2nd script, the
first script closes, and the 2nd script continues to run and pops up all 10
message boxes.

When we put the first script in the GPO, when the user logs in, the 2nd
script kicks off, pops up one message box, but then the first script ends
(the black window goes away) and then the message box that was up from the
2nd script also goes away all by itself and no more message boxes appear.

Hopefully that all makes sense.
 
 
 

vb script called from login script exits when login script ter

Post by v-wywan » Fri, 05 Oct 2007 15:37:45

Hello CLH,
Thanks for your reply.

Have you set scripts to run synchronously in the GPO?
This may be the reason, if you haven't done this.

Computer Configuration > Administrative Templates > System >Scripts > Run
Logon Scripts Synchronously = enabled

This will force Explorer.exe to wait until the script has completed before
running.
http://www.yqcomputer.com/
px?mfr=true
[Run logon scripts synchronously]

Hope this helps.
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

 
 
 

vb script called from login script exits when login script ter

Post by Y2xo » Sat, 06 Oct 2007 00:28:01


I apologize if this is not the case, but I think you misunderstand the
question. We do have the policy set as described, and that part of it works.
The first script does kick off and run synchronously. The issue is that we
have 2 different scripts that we want to run at login. One script we want to
run synchronously (contains drive mappings and other things that we want to
be sure get done before the user gets their desktop), but the other script we
want to run asynchronously (has things aren't as critical and we DON'T want
to hold the user up from getting to their desktop to begin working while this
stuff runs).

For example purposes I'll call the main synchronous script "syncscript.vbs"
and the secondary asyncronous script "asynchscript.vbs".

We have the GPO configured to run scripts synchronously as you mentioned
above.

The GPO in active directory for our OU points to the synchscript.vbs. That
script does indeed kick off and run synchronously.

To run the second script asychronously, in the synchscript.vbs the last line
is the following:
wshShell.Run "asyncscript.vbs", 0, False

The False on that line tells the synchscript.vbs to NOT wait for the
asynchscript.vbs to finish before continuing.

The asyncscript.vbs does indeed kick off and begin running. The problem is
that once the original synchscript.vbs terminates it ALSO terminates the
asyncscript.vbs even though that asyncscript.vbs has not finished.

If I run synchscript.vbs manually it will kick off asyncscript.vbs properly,
synchscript.vbs terminates, and asynchscript.vbs KEEPS running as expected.
It's only when we run the syncscript.vbs as a login script assigned to a GPO
that it terminates that asyncscript.vbs prematurely.

Thanks again.
 
 
 

vb script called from login script exits when login script ter

Post by v-wywan » Sat, 06 Oct 2007 19:59:08

Hello CLH,
Thanks for your reply.

I'm sorry I misunderstood the issue before. Now, I understood your issue as
below:
The synchronous part of VBScript works fine. Explorer.exe waits until the
script has completed before running. The issue is that asynchronous part of
VBScipt is terminated after the synchronous part of logon script is
finished.
Please correct me if I misunderstood anything here again.

I reproduced this issue on my side.
After performed further research, I noticed this behavior is by design.

*If your Windows 2000 logon script runs synchronously, all child processes
are stopped when the logon script ends.*
http://www.yqcomputer.com/
[7938 " When your Windows 2000 logon script ends, child processes started
by the script also end? 15-Apr-04]

We cannot combine these two part of login script in one script.
My suggestion is that you may set the asynchronous part of your Logon
Script as Logon Script in (Administrative Templates|System|logon|"Run this
progame at user login"). Thereby, it will be executed after user gets their
desktop.
Under my test, this way seems work fine on my side.

Would you please try the above method and let me know if it works on side?
If you face any further issue or there is anything unclear, please feel
free to let me know. We are glad to assist you.

Hope this helps,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
 
 

vb script called from login script exits when login script ter

Post by v-wywan » Thu, 11 Oct 2007 20:46:22

Hello CLH,
Thanks for your reply and clarifying.

Hope my suggestion helps in your scenario. I have tried it on my side. It
seems works fine.
I'm standing by. If you face any further issue or there is anything
unclear, please don't hesitate to update here again. I will follow up. It's
my pleasure to be of assistance.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
 
 

vb script called from login script exits when login script ter

Post by Y2xo » Sun, 21 Oct 2007 03:13:02

I've finally had a chance to test this out and it seems to work okay. Thanks
for the suggestion!
 
 
 

vb script called from login script exits when login script ter

Post by v-wywan » Tue, 23 Oct 2007 16:26:56

You are welcome. :)
The pleasure is all mine.

Have a great day,
Best regards,

Wen Yuan
Microsoft Online Community Support
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.