Return to beginning of script if condition is ture/false

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
End If
'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)


Relevant Pages