Re: VBscript in 2008 Server Task Scheduler will not run



Anything that works in the 32-bit version works in the 64-bit version, in general. That means that yes, pointing directly to the script should work ok; it will probably default to the 64-bit version of the host IIRC, but that should be ok. Like I said, I suspect the real issue is the file paths inside the script file.

Just to confirm that the script host is running ok, you can perform a null test for comparison. Create a script that does absolutely nothing, just has a couple of blank lines, and schedule it. You should get no failures. If you want to confirm it by seeing that yes, it is running, you could insert a line into the do-nothing script like

WScript.Sleep 120000

That should tell it to sleep for 2 minutes, giving you sufficient time after a scheduled start to check task manager and confirm that the script is indeed running.

"ChuckT" <ChuckT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:BA6E9F9C-B90D-46AA-848C-2635B1430780@xxxxxxxxxxxxxxxx
Hi Alex:

Thank you for the help.

Do you need to point directly to the Cscript.exe in 2008 x64?

In 2003 server and 2008 32 bit you can just point the task scheduler command
window to the vbs file and it runs.

In 2008 x64 do I need to point the command window in System32 and then in
the parameters insert the path and name of the vbs file?

I'll try that.

Looks like we could do this also in power shell but it might take a couple
of days to learn that tool well enough to do a script like this one.

Thanks again for the help :)

Chuck

"Alex K. Angelopoulos" wrote:

Chuck, on the 64-bit server, double-check those file paths you have. On
64-bit Windows, 32-bit applications are stored in Program Files (x86)
instead of Program Files. That looks like the issue.

Although you're right to be concerned about whether you should use the 64 or
32-bit WSH host in general, for this situation it won't matter. Use the
64-bit version (which is located in System32 due to historic compatibility
issues) and make sure you're using the cscript.exe console host. If this
doesn't work, there are other issues that may need to be examined; make sure
all of the log files mentioned in the script exist in the locations
specified.

"ChuckT" <ChuckT@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2684BED7-BC63-49F3-90A4-D31430114246@xxxxxxxxxxxxxxxx
> We have a script that we use that exports SharePoint data and then > copies
> it
> to a share on another server. This works fine on the 2003 Server we > had
> it
> on before.
>
> If I run the script from the commmand line on the new 2008 server it > works
> fine. In the settings we are signed on with an admin account.
>
> The new server we migrated to is 2008 x64.
>
> We have another 2008 32 bit server that has a similar script and it is
> working without incident.
>
> We are not sure which is the right script executable to use. In the
> System32 there is both a cscript.exe and a wscript.exe and there is > also a
> cscript.exe and wscript.exe in the SysWow64.
>
> We have tried several combinations to get this t o run.
>
> The only error we get in task scheduled is either invalid file or > invalid
> directory.
>
> Since it runs from the command prompt we are wondering about why we > would
> get that.
>
> If we run it using the RUN command in the 2008 scheduler it hangs.
>
> I am hoping someone has run into this and solved it.
>
> I'm stuck.
>
> Here is the script (sorry its a bit long)
>
> Dim mToday
> Dim mPath
> dim sTemp
> dim command1
> dim commandparm
> dim command2
> dim inline
> dim i
> dim oExec
> dim input
> dim inputData
> dim cmdstring
> dim Dest
> dim mFirst
> dim mSecond
> dim emailsendto
> dim emailsubject
> dim emailbody
> dim emailfrom
> dim emailsender
> dim freespace
> Const HARD_DISK = 3
> Const CCS_DISK = 4
> Const GB = 1073741824
>
> set objShell = CreateObject("Wscript.shell")
> Set oWmg = GetObject("winmgmts:")
> set objFS = CreateObject("Scripting.FileSystemObject")
> if objFS.FileExists("DailyBackup.log") Then
> objFS.DeleteFile("DailyBackup.log")
> WScript.Sleep 1000
> End If
> set objLog = objFS.CreateTextFile("DailyBackup.log",8, true)
>
>
>
> objlog.writeline(now() &vbTab& "Start: Daily Backup ")
> mToday = Day(Now())
>
> set objInput = CreateObject("Scripting.FileSystemObject")
> if objInput.FileExists("ShrptBackupSettings.log") Then
> set filein = objInput.OpenTextFile("c:\program files\common
> files\microsoft
> shared\web server extensions\12\Bin\shrptbackupsettings.log", 1)
> input = Split(filein.ReadAll, vbNewLine)
>
> For each inputData in input
> if Instr(1, inputData, "DESTDAILY:") Then
> mleft = Instr(1, inputData, ":")
> mLen = (inputData)
> ServerDest = " " & Mid(inputData, mLeft +1)
> mServerStart = Instr(mleft, inputdata, "\\")
> if mServerStart > 0 then
> mServerEnd = Instr(mServerstart + 2, inputdata, "\")
> if mServerEnd > 0 then
> strComputer = mid(inputdata, mserverstart +2, (mServerEnd -
> (mServerStart + 2)))
> if Len(strComputer) > 0 Then
> REM Set objWMIService = GetObject("winmgmts:\\" & strComputer)
> Set objwMIService =
> GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
>
> Set colDisks = objWMIService.ExecQuery _
> ("SELECT * FROM Win32_LogicalDisk WHERE DriveType = " & HARD_DISK)
> For Each objDisk in colDisks
> numDiskSpace = objDisk.Size
> numFreeSpace = objDisk.FreeSpace
> emailbody = emailbody & "Computer Name: " & strComputer & vbcrlf
> emailbody = emailbody & "Disk Name: " & objDisk.name & vbcrlf
> emailbody = emailbody & "Disk Size: " & Left(numDiskSpace/GB, 4) &
> " GB" & vbcrlf
> emailbody = emailbody & "Free Space: " & Left(numFreeSpace/GB, 4)
> & " GB" & vbcrlf
> emailbody = emailbody & Left((numFreeSpace / numDiskSpace) * 100,
> 4) & "%" & vbcrlf
> emailbody = emailbody & "Percent Free: " & Left((numFreeSpace /
> numDiskSpace) * 100, 4) & vbcrlf
> Next
> End if
>
> End IF
> End if
> End if
> if Instr(1, inputData, "SENDTO:") Then
> mleft = Instr(1, inputData, ":")
> mLen = (inputData)
> emailsendto = " " & Mid(inputData, mLeft +1)
> End if
> if Instr(1, inputData, "SUBJECT:") Then
> mleft = Instr(1, inputData, ":")
> mLen = (inputData)
> emailsubject = " " & Mid(inputData, mLeft +1)
> End if
> if Instr(1, inputData, "FROM:") Then
> mleft = Instr(1, inputData, ":")
> mLen = (inputData)
> emailfrom = " " & Mid(inputData, mLeft +1)
> End if
> if Instr(1, inputData, "SENDER:") Then
> mleft = Instr(1, inputData, ":")
> mLen = (inputData)
> emailsender = " " & Mid(inputData, mLeft +1)
> End if
>
> IF Instr(1,inputData,"SITE:") Then
> mLeft = Instr(1, inputData, ":")
> mLen = (inputData)
> sitename = Mid(inputData, mLeft + 1)
> mHttp = Instr(1, inputdata, "//")
> mFirst = instr(mhttp +2, inputdata, "/")
> mLen = Len(inputdata)
> mSiteNamelen = (mLen - (mFirst + 1))
> if mFirst > 0 then
> mSecond = Instr(mFirst + 1, sitename, "/")
> end If
>
> if mSecond > 0 then
> mLen = Len(inputdata - mSecond)
> Dest = Right(inputdata, mLen)
> else
> mSiteLen = Len(mLen - mFirst)
> Dest = mid(inputdata, mFirst +1, (mLen -mFirst))
> End if
> DestSite = Trim(Dest) & ".dat"
> objlog.writeline(now() &vbTab& "Creating dailybackup for: " & sitename > &
> " Daily Folder: " & mToday )
> command1parm = " c:\program files\common files\microsoft shared\web
> server extensions\12\bin"
> command1term = ", 0 , True"
> cmdstring = "cmd /k stsadm -o export -url " & sitename & " -filename " > &
> ServerDest & mToday & "\" & DestSite & " -includeusersecurity -versions > 4
> -overwrite"
>
> command1 = "cmd /k cd c:\program files\common files\microsoft > shared\web
> server extensions\12\bin"
> objlog.writeline(now() &vbTab& command1 )
>
> Set oExec = objShell.Exec(cmdstring)
> objlog.writeline(now() &vbTab& cmdstring)
> Do While Not oExec.StdOut.AtEndOfStream
> strText = oExec.StdOut.ReadLine()
> If Instr(1, strText, "error" ) Then
> emailbody = emailbody & "Backup of :" & sitename & ":" & strText &
> vbcrlf
> Exit Do
> End If
>
> Loop
>
> End if
> Next
> else
> REM email the users
> MsgBox "ShrptBackupSettings.Log not found cannot continue"
> Wscript.quit
>
> End if
>
>
> objlog.writeline(now() &vbTab& command2 )
>
> REM strWndprs = "select * from Win32_Process where name='cmd.exe'"
> REM Set objQResult = oWmg.Execquery(strWndprs)
>
> REM For Each objProcess In objQResult
>
> REM intReturn = objProcess.Terminate(1)
>
> REM Next
>
>
>
> set objSendMail = CreateObject("CDO.Message")
> set iConf = CreateObject("CDO.Configuration")
> set Flds = iConf.Fields
> Flds("http://schemas.microsoft.com/cdo/configuration/sendusing";) = 1
> Flds.Update
> set objSendMail.Configuration = iConf
>
> objSendMail.From = emailfrom
> objSendMail.Subject = emailsubject
> objSendMail.Sender = emailsender
> objSendMail.To = emailsendto
> objSendMail.TextBody = emailbody
> objSendMail.Send
>
>
> wscript.quit
>
>
>

.



Relevant Pages

  • VBscript in 2008 Server Task Scheduler will not run
    ... We have a script that we use that exports SharePoint data and then copies it ... This works fine on the 2003 Server we had it ... Dim mToday ... For each inputData in input ...
    (microsoft.public.scripting.vbscript)
  • Re: check disk space and email if above xx%?
    ... ' DriveSpace to HTM and email results VBS script ... 'This script will pull a listing of servers from (in this example, ... 'Additionally, in the summary and warning htm, each server has been ... Dim strComputer, Silent, strGBFree, strDiskFreeSpace, strDrvString ...
    (microsoft.public.scripting.vbscript)
  • Re: VBscript in 2008 Server Task Scheduler will not run
    ... pointing directly to the script should work ... In 2008 x64 do I need to point the command window in System32 and then in ... Dim mToday ... For each inputData in input ...
    (microsoft.public.scripting.vbscript)
  • Re: Script taking longer than expected to complete: Consequences?
    ... If the user closes the browser window, the script will continue to run on ... Once the request is made to the server, ... > Dim sql ...
    (microsoft.public.inetserver.asp.general)
  • Using VBScript to accept POST data
    ... I would like to have the web server either host a VBS file, ... Dim objShell, objScriptExec, a, strIpConfig, myvar ... first script into this script as an agrument, ... Dim strDirectory, strFile, strText ...
    (microsoft.public.scripting.vbscript)

Loading