Singnetsvc
asked on
VB Script - Fails full execution first run, prompts empty box seconond rum
Hi All
I am currently working on a online avaliable script which takes a shadow backup of virtual images attached to virtual server. My Issue is that the script does not run full function first attempt, but displays an empty box with an OK botton on second attempt.
The script creates two windows command line files, if they dont exist on first run, the second half of the script fail to run. If they do exist, a bocx with an OK button appears whcih must be pressed in order to have the script continue and complete. My issue is that i need to identify what is causing the empty box and how do i get rid of it so that teh script can complete.
The code that i believe is having the issue is below
Regards, Alan
I am currently working on a online avaliable script which takes a shadow backup of virtual images attached to virtual server. My Issue is that the script does not run full function first attempt, but displays an empty box with an OK botton on second attempt.
The script creates two windows command line files, if they dont exist on first run, the second half of the script fail to run. If they do exist, a bocx with an OK button appears whcih must be pressed in order to have the script continue and complete. My issue is that i need to identify what is causing the empty box and how do i get rid of it so that teh script can complete.
The code that i believe is having the issue is below
Regards, Alan
Set objVM = Nothing
' Create Shadow copy of VM drive
oExCmd.WriteLine "vshadow.exe -script=setvar1.cmd -p d:"
oExCmd.WriteLine "call setvar1.cmd"
oExCmd.WriteLine "vshadow.exe -el=%SHADOW_ID_1%,x:"
oExCmd.Close
Result = objShell.run(sExCmd,vbMinimized, TRUE)
'BOX APPEARS HERE'
' Start VM machine up from saved state
For each objVM in virtualServer.VirtualMachines
'See if vm machine is Saved. If so then resume
If objVM.State = 2 then
'Start virtual machine
objVM.Startup
End If
Next
Set objVM = Nothing
WScript.Sleep 10000
If Result = 0 then
'Loop through all vm machines
For each objVM in virtualServer.VirtualMachines
'See if vm machine is running. If so copy shadow backup of vm disk drives
If objVM.State = 5 then
'Copy virtual hard disks and undo disks
For each vhd in objVM.HardDiskConnections
MyArray = Split(vhd.undoHardDisk.file,"\")
Filename = MyArray(Ubound(MyArray))
SourceName = "x" & Right(vhd.undoHardDisk.file,Len(vhd.undoHardDisk.file)-1)
wscript.echo vhd.undoHardDisk.file
wscript.echo SourceName
objFSO.CopyFile SourceName,DestBackupDir & Filename
MyArray = Split(vhd.HardDisk.file,"\")
Filename = MyArray(Ubound(MyArray))
SourceName = "x" & Right(vhd.HardDisk.file,Len(vhd.HardDisk.file)-1)
objFSO.CopyFile SourceName,DestBackupDir & Filename
Next
End If
ASKER
I dont know if this wil help, but i have observered the following behaviour
The x drive is created
The script waits for the creation copy of the VSV and VMC file to be coped. After a delay, the prompt appears with no text. Once the OK option is selected immediatly the VHD file shows up in teh backup
I have a huncht that the attached code is the issue. How do i stop prompts from appearing.
Regards, Alan
The x drive is created
The script waits for the creation copy of the VSV and VMC file to be coped. After a delay, the prompt appears with no text. Once the OK option is selected immediatly the VHD file shows up in teh backup
I have a huncht that the attached code is the issue. How do i stop prompts from appearing.
Regards, Alan
Result = objShell.run(sExCmd,vbMinimized, TRUE)
ASKER
Actually i retract that. The images start up then the prompt appears after the following delay
WScript.Sleep 10000
If Result = 0 then
'Loop through all vm machines
For each objVM in virtualServer.VirtualMachines
'See if vm machine is running. If so copy shadow backup of vm disk drives
If objVM.State = 5 then
'Copy virtual hard disks and undo disks
For each vhd in objVM.HardDiskConnections
MyArray = Split(vhd.undoHardDisk.file,"\")
Filename = MyArray(Ubound(MyArray))
SourceName = "x" & Right(vhd.undoHardDisk.file,Len(vhd.undoHardDisk.file)-1)
wscript.echo vhd.undoHardDisk.file
wscript.echo SourceName
objFSO.CopyFile SourceName,DestBackupDir & Filename
MyArray = Split(vhd.HardDisk.file,"\")
Filename = MyArray(Ubound(MyArray))
SourceName = "x" & Right(vhd.HardDisk.file,Len(vhd.HardDisk.file)-1)
objFSO.CopyFile SourceName,DestBackupDir & Filename
Next
End If
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window