Scripts Thread, Script overlap - synchronicity? in Coding and Web Development; Something has cropped up with a number of my VBS login scripts lately that seems to indicate that the GPO ...
-
19th October 2007, 11:33 AM #1 Script overlap - synchronicity?
Something has cropped up with a number of my VBS login scripts lately that seems to indicate that the GPO for "run scripts asynchronously - DISABLED" is being ignored.
I have two scripts that run one after the other in which one uses a mapped network letter for a temp folder, disconnects and then reconnects to a specific folder for the actual users usage.
For some reason though the system seems to be creating the temp mapping and then disconnecting it completely, not renewing.. and the only reason I can find for the behaviour is that both scripts are running at the same time.
I've also noticed that some users get the behaviour while others don't and it's confusing the heck out of me..
Any suggestions or tips ?
-
-
IDG Tech News
-
6th November 2007, 10:09 PM #2
- Rep Power
- 0
Re: Script overlap - synchronicity?
Hello,
Debugging scripts within AD can be fun (with some liberties taken in the definition of "fun").
There are several things that you can do. One would be to combine both scripts into one. That way there is no worry about asynchronicity (unless the situation in option two is happening).
Option two would be to use the DriveExists method on your second script. Sometimes it take a couple of bits for a drive to map or unmap (which could be why it sometimes works and sometimes does not). You could use the DriveExists method to wait until the drive does not exist (with a cutoff of a maximum number of seconds so you don't get stuck in a loop). You can look at this technet site for info about that method: http://msdn2.microsoft.com/en-us/library/t565x0f1.aspx
Here is the code that I made for that:
Set objFSO = CreateObject("Scripting.FileSystemObject")
strDrivePath = "q" 'Use drive letter or UNC path (does not seem to be case sensitive)
bolWait = True
While bolWait = True
WScript.Sleep 100 '1/10 of a second
intCounter = intCounter + .1
If objFSO.DriveExists(strDrivePath) Then
bolWait = False
End If
If intCounter >= 10 Then 'Waits for 10 seconds-adjust as needed
bolWait = False
End If
Wend
An another option, you could also have your two scripts write to a log file to see if they are indeed overlapping. Toss the following code into your scripts.
const txtDebugLogFile = "c:\DebugLog.txt"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objLogFile = objFSO.opentextfile(txtDebugLogFile,8,true)
strStartTime = Time()
'
'Put the rest of your script here
'
strEndTime = Time()
objLogFile.writeline Wscript.ScriptFullName & "," & txtStartTime & "," & txtEndTime
objLogFile.close
There are probably more ways to look at this but hopefully this will help. Best of luck and feel free to respond with questions if needed.
-
-
6th November 2007, 11:38 PM #3 Re: Script overlap - synchronicity?
Ahah... perfect...
Thanks for those suggestions.. I'll give the driveExists idea a run first before I go for anything more drastic but yeah, much appreciated
-
SHARE:
Similar Threads
-
By salan in forum Windows
Replies: 8
Last Post: 8th November 2007, 07:55 PM
-
Replies: 0
Last Post: 7th November 2007, 12:48 AM
-
By Galway in forum Windows
Replies: 3
Last Post: 29th August 2007, 11:00 AM
-
By wesleyw in forum Scripts
Replies: 4
Last Post: 5th July 2007, 01:58 PM
-
Replies: 8
Last Post: 28th September 2006, 07:21 AM
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules