none
Windows Scheduler with VB Script RRS feed

  • Question

  • Hey Everyone,

    I have a VB Script that I am attempting to schedule to run every 5 minutes in Windows Scheduler. The script checks if it's running on a 32 bit or 64 bit server. If it is a 64 bit server, IE is ran in 32 bit mode via wscript.  The script continues by logging into our web application with a user account, accesses a few areas, then signs out. The script itself is working flawlessly. The Scheduled Task also runs fine if I'm logged into the server and a useage log entry in our web application appears for the script user.

    For 64 bit servers - when I am not logged onto the server, the Scheduled Task appears to have ran (checked the "View Log" in Windows\Tasks - Advanced Tab), yet no useage log appears for that script user in our web application.

    "Result: The task completed with an exit code of (0)."

    My Run command in Windows Scheduler is: C:\WINDOWS\system32\wscript.exe scriptlocation

    I've also tried just the script location with no luck.

    If I comment out the "Force32bit" section, the script will run and show useage log entries when I'm not logged into the server, but I'm not able to access URL's that contain flash components.

    Other notes:

    -Scheduled Task is running under local Administrator login.
    -I have tried this on 4-5 of our 64 bit servers with the same issue.
    -Checked permissions on wscript.exe - Full Admin rights

    Option Explicit 
      
    Main()
      
    Sub Main() 
    Force32bit() 
    Dim objExplorer : Set objExplorer = CreateObject("InternetExplorer.Application") 
         
    'Internet Explorer is shown - turn off (0) after testing
    objExplorer.Visible = 1 
    	
    'Landing Page
    objExplorer.Navigate "URL #1" 
     WScript.Sleep 6000
    	
    'Chart Page
     objExplorer.Navigate "URL #2"
     WScript.sleep 6500
    			
     objExplorer.Quit
     End Sub 
      
    
     Sub Force32bit() 
         If InStr(UCase(WScript.FullName), "SYSTEM32") > 0 And CreateObject("Scripting.FileSystemObject").FolderExists("C:\Windows\SysWOW64") Then 
             Dim objShell : Set objShell = CreateObject("WScript.Shell") 
             objShell.CurrentDirectory = "C:\Windows\SysWOW64" 
             objShell.Run "wscript.exe " & WScript.ScriptFullName,1,False 
             WScript.Quit 
         End If 
     End Sub
    Wednesday, February 10, 2010 11:51 PM

Answers

  • This issue is now resolved. There were several "wscript.exe *32" processes running that somehow prevented the script from running completely, but only when I'm logged out of the server which is quite strange...

    After ending these extra processes, the script seems to properly end the wscript process after execution.

    If there is any additional insight on this I'd be glad to read it :)
    Thursday, February 11, 2010 4:49 AM

All replies

  • This issue is now resolved. There were several "wscript.exe *32" processes running that somehow prevented the script from running completely, but only when I'm logged out of the server which is quite strange...

    After ending these extra processes, the script seems to properly end the wscript process after execution.

    If there is any additional insight on this I'd be glad to read it :)
    Thursday, February 11, 2010 4:49 AM
  • Is that question somehow ConfigMgr related? Or should I move it to a scripting forum?
    Thursday, February 11, 2010 7:04 AM
    Moderator
  • Torsten - if additional questions do arise that are scripting related from this thread please move to the forum you deem appropriate.

    E
    Thursday, February 11, 2010 3:14 PM
    Moderator