Return to beginning of script if condition is ture/false
- From: "xr7" <ewilson@xxxxxxxx>
- Date: 22 Nov 2005 11:49:20 -0800
I have the following in one of my scripts. What I need to do is if
err.number <> 0, write that to a a log and then return to the beginning
of the For Each to completely skip the rest of the scripted operations
(on that item of the collection) that were dependent on Err.number
being 0. how can i do that?
For each vmName in vmCollection
Set objVM = CreateObject("vmCom.vmCtl")
objVM.Connect cp, vmName
strVM = vmName
'If the VM is powered on, shut it down and run the rest of the script
If objVM.ExecutionState = vmExecutionState_On Then
objLog.Writeline NOW & " " & strVM & " attempting shutdown"
If Err.Number = 0 Then
objLog.Writeline NOW & " " & strVM & " off"
objLog.Writeline NOW & " " & Err.Number & Err.Description
'Do a ton of stuff here that depends on err.number being 0. If
err.number <> 0 I want to go to the Next item in the collection
(vmName in vmCollection)
- Prev by Date: Re: XP firewall - open ports 135 and 445 limited to a specific IP address?
- Next by Date: Re: ADO stream , command outout stream ,asp
- Previous by thread: Open IE using VBScript
- Next by thread: Re: Return to beginning of script if condition is ture/false