Click here to Skip to main content
15,896,557 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionException Handling Problem Pin
RCoate2-Jul-08 17:10
RCoate2-Jul-08 17:10 
AnswerRe: Exception Handling Problem Pin
Mycroft Holmes2-Jul-08 17:21
professionalMycroft Holmes2-Jul-08 17:21 
GeneralRe: Exception Handling Problem Pin
RCoate2-Jul-08 17:46
RCoate2-Jul-08 17:46 
GeneralRe: Exception Handling Problem Pin
Mycroft Holmes2-Jul-08 18:17
professionalMycroft Holmes2-Jul-08 18:17 
GeneralRe: Exception Handling Problem Pin
Paul Conrad2-Jul-08 18:32
professionalPaul Conrad2-Jul-08 18:32 
AnswerRe: Exception Handling Problem Pin
Gideon Engelberth2-Jul-08 17:52
Gideon Engelberth2-Jul-08 17:52 
GeneralRe: Exception Handling Problem [modified] Pin
RCoate2-Jul-08 18:02
RCoate2-Jul-08 18:02 
QuestionVBscript, CreateFolder & Scheduler confusion. Pin
Member 37212832-Jul-08 7:01
Member 37212832-Jul-08 7:01 
I'm stumped on something that should be simple, but.....
I've written a VBscript to create a folder on an IOMega NAS box using objFSO.CreateFolder, and copy some files to it for backup. It runs on a server using Win2003R2. The NAS box is mapped to a local drive letter on this server.
I use cscript to run the script, fired off by the scheduler at night, under an Administrator user ID.
The script works fine in debug mode.
If I execute the script from a Run|cmd command line, it works fine.
When kicked off by the scheduler, it always fails on the CreateFolder method with a 76 error (path not found).
But if I open the scheduler, right click on the job and select "Run", it runs the job with no problems and completes successfully!
I've inserted some debug code before the CreateFolder, checking for FolderExists on the NAS box and that is always successful. The first hint of trouble is the 76 error on the CreateFolder method.
Here's some of the code. "x" is the mapped drive.
BTW: all of the code referencing "NAS disks to spinup" was added to get around this 76-error problem, under the assumption that idled disks were the culprit; none of it helped.

Const Backupfolder = "x:\Data Backups"
.
.
.
' Checking to see if NAS disks are still spinning
If objFSO.FolderExists(Backupfolder) Then i=1
writelog ("check that NAS disks are spinning: err.num: " & Err.Number & "   " & Err.Description)
errHandler ("checking if NAS disks are spinning")
	
' Generate today's directory name in the format   yymmdd
strmonth = month(date)
if strmonth < 10 then strmonth = "0" & strmonth
strday = day(date)
if strday < 10 then strday = "0" & strday
todaysfolder = right(year(date),2) & strmonth & strday

' Now create the full pathname to today's backup folder
todayspath = Backupfolder & "\" & todaysfolder

' Create todays backup folder
If objFSO.FolderExists(todayspath) Then
    Set objbkupFolder = objFSO.GetFolder(todayspath)
	writelog(todayspath & " already exists!")
Else
    writelog("Creating folder " & todayspath)
	Err.Clear
	Set objbkupFolder = objFSO.CreateFolder(todayspath)
	If Err.Number <> 0 Then
		writelog ("Waiting 15 seconds for NAS disks to start.  Err: " & Err.Number & "  " & Err.Description)
		Err.Clear
		objbkupFolder = nothing
		Wscript.Sleep 15000		'Wait 15 seconds for NAS disks to spin up
		Set objbkupFolder = objFSO.CreateFolder(todayspath)
		If Err.Number <> 0 Then
			errHandler (" trying to create folder " & todayspath)
			abendscript
		End If
	End If

End If


Anybody have any ideas on this?

Jeff
AnswerRe: VBscript, CreateFolder & Scheduler confusion. Pin
Dave Kreskowiak2-Jul-08 7:14
mveDave Kreskowiak2-Jul-08 7:14 
GeneralRe: VBscript, CreateFolder & Scheduler confusion. Pin
Member 37212832-Jul-08 20:26
Member 37212832-Jul-08 20:26 
Questiontimer vs thread Pin
Ebube2-Jul-08 5:58
Ebube2-Jul-08 5:58 
AnswerRe: timer vs thread Pin
Dave Kreskowiak2-Jul-08 7:12
mveDave Kreskowiak2-Jul-08 7:12 
AnswerRe: timer vs thread Pin
Ebube2-Jul-08 7:15
Ebube2-Jul-08 7:15 
GeneralRe: timer vs thread Pin
Luc Pattyn2-Jul-08 7:42
sitebuilderLuc Pattyn2-Jul-08 7:42 
AnswerRe: timer vs thread Pin
KarstenK3-Jul-08 1:12
mveKarstenK3-Jul-08 1:12 
QuestionVBA/Excel Pin
torgerjl2-Jul-08 3:53
torgerjl2-Jul-08 3:53 
AnswerRe: VBA/Excel Pin
RCoate2-Jul-08 17:13
RCoate2-Jul-08 17:13 
AnswerRe: VBA/Excel Pin
Andy_L_J2-Jul-08 22:35
Andy_L_J2-Jul-08 22:35 
Questionvb6 & vb.net comparison Pin
jds12072-Jul-08 2:58
jds12072-Jul-08 2:58 
AnswerRe: vb6 & vb.net comparison Pin
Baixinho2-Jul-08 3:23
Baixinho2-Jul-08 3:23 
AnswerRe: vb6 & vb.net comparison Pin
John_Adams2-Jul-08 4:52
John_Adams2-Jul-08 4:52 
AnswerRe: vb6 & vb.net comparison Pin
Paul Conrad2-Jul-08 4:54
professionalPaul Conrad2-Jul-08 4:54 
AnswerRe: vb6 & vb.net comparison Pin
supercat92-Jul-08 5:30
supercat92-Jul-08 5:30 
AnswerRe: vb6 & vb.net comparison Pin
sa_runner2-Jul-08 5:59
sa_runner2-Jul-08 5:59 
AnswerRe: vb6 & vb.net comparison Pin
jzonthemtn2-Jul-08 6:01
jzonthemtn2-Jul-08 6:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.