Re: VBScript halts with out error message

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"Dan" <Dan@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:F4697881-9ED9-4829-9791-1B5D87249F0F@xxxxxxxxxxxxxxxx
I have a script that creates and calls a batch file. It runs through 17
commands and then freezes. If I exit the script and run the batch file it
created, it runs fine. The command lines are based on IIS websites. If I
remove the websites surrounding the point of failure and run the script,
it
still processes exactly 17 command (which is also 17 websites.) Any
ideas?
Here is the script:

Const ForReading = 1
Const ForWritting = 2
Const ForAppending = 8

Set fso = CreateObject("Scripting.FileSystemObject")
Set strFile = fso.OpenTextFile("D:\BatchJobs\WebSiteSync\sites.txt",
ForReading)
Set strCommand = fso.OpenTextFile("D:\BatchJobs\WebSiteSync\Sync.bat",
ForWritting)
set strLog = fso.openTextFile("D:\BatchJobs\WebSiteSync\msdeploysync.log",
ForWritting)

strLog.WriteLine Date() & " " & Time()
strLog.WriteLine "Calling Creation of Web Site List"


Dim oWsc, oExec
Set oWsc = CreateObject("WScript.Shell")
Set oExec = oWsc.Exec("D:\BatchJobs\WebSiteSync\CreateList.bat")
' wait until finished
Do While oExec.Status <> 1
WScript.Sleep 100
Loop

strLog.WriteLine err.number & " " & err.description
err.number = 0
strLog.WriteLine
strLog.WriteLine "Reading WebSites"
strLog.WriteLine

strCommand.WriteLine "msdeploy -verb:sync -source:appPoolConfig
-dest:appPoolConfig,computerName=IISServer2"
Do Until strFile.AtEndOfStream
s = strFile.ReadLine
x = Instr(s, chr(34))
if x > 0 then
SiteName = right(s, len(s) - x)
end if
y = Instr(SiteName, chr(34))
if y > 0 then
SiteName = left(SiteName,y-1)
end if
if SiteName <> "Default Web Site" then
strCommand.WriteLine "msdeploy -verb:sync -source:apphostconfig=" &
chr(34) & SiteName & chr(34) & ",includeAcls=true -dest:apphostconfig=" &
chr(34) & SiteName & chr(34) & ",computerName=IISServer2 -debug -verbose
>>
D:\BatchJobs\WebSiteSync\msdeploysync.log"
end if
loop

strLog.WriteLine "Calling Sync.bat"
strLog.WriteLine


strFile.Close
strCommand.Close
strLog.close

Set oExec = oWsc.Exec("D:\BatchJobs\WebSiteSync\Sync.bat")
Do While oExec.Status <> 1
WScript.Sleep 30000
Loop

set strLog = fso.openTextFile("D:\BatchJobs\WebSiteSync\msdeploysync.log",
ForAppending)
strLog.WriteLine "Finished at " & Date() & " " & Time()
strLog.close

The Exec method is not suitable when you need to wait until a shell command
has completed its operation. Use the Run method instead - it accepts an
optional parameter bWaitOnReturn.


.



Relevant Pages

  • Re: script or multiple configurations to use different network settings
    ... i am thinking in a group of script with the required data in each ... Const Adapter = "Local Area Connection" ... there is no inbuilt command to change ... SendKey statements, starting from the bottom, by placing a ...
    (microsoft.public.windowsxp.general)
  • 424 Object Required Problem
    ... I've a script that connects to the registry of a remote ... //nologo" from the command line logged on with a domain admin account. ... Const HKEY_LOCAL_MACHINE = &H80000002 ...
    (microsoft.public.scripting.vbscript)
  • Re: VBScript halts with out error message
    ... But despite numerous arrangements of the .run line with varied parameters, ... If I exit the script and run the batch file it ... The command lines are based on IIS websites. ... Const ForWritting = 2 ...
    (microsoft.public.scripting.vbscript)
  • Re: log off command
    ... If it doesn't try running the script from cmd and look what errors you get ... SOON 3600 LOGOFF %ID% ... do you think you could help me with the syntax for that command? ... Const SHUTDOWN = 1 ...
    (microsoft.public.windowsxp.basics)
  • Re: urllib working differently when run from crontab
    ... websites. ... When I run the script from my ... command line everything works as intended. ... Perhaps you have an http_proxy environment variable set in the ...
    (comp.lang.python)