+ Post New Thread
Results 1 to 3 of 3
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 ...
  1. #1
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    119

    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 ?

  2. #2

    Join Date
    Nov 2007
    Posts
    8
    Thank Post
    0
    Thanked 0 Times in 0 Posts
    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.

  3. #3
    contink's Avatar
    Join Date
    Jul 2006
    Location
    South Yorkshire
    Posts
    3,791
    Thank Post
    303
    Thanked 327 Times in 233 Posts
    Rep Power
    119

    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:
+ Post New Thread

Similar Threads

  1. Help with KIX script please
    By salan in forum Windows
    Replies: 8
    Last Post: 8th November 2007, 07:55 PM
  2. Best script ever!
    By Zabu in forum Scripts
    Replies: 0
    Last Post: 7th November 2007, 12:48 AM
  3. Logon script & Printer script question.
    By Galway in forum Windows
    Replies: 3
    Last Post: 29th August 2007, 12:00 PM
  4. Does anyone have a script...
    By wesleyw in forum Scripts
    Replies: 4
    Last Post: 5th July 2007, 02:58 PM
  5. AUP Script thats not quite good enough
    By Pear in forum Scripts
    Replies: 8
    Last Post: 28th September 2006, 08: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
  •