VMware Communities > VMTN > VMware Serverâ„¢ > VMware Server 1 > Discussions
1 2 3 4 Previous Next
55 Replies Last post: Dec 30, 2008 5:06 AM by solsie
Reply

Backup vbscript for VMWare Server: Only ~1min downtime

Dec 6, 2007 7:22 PM

Click to view zgn667's profile Novice zgn667 16 posts since
Oct 26, 2007
I've been working on this script for the last week for my school's admission office. I'm no vbscript expert, but I know enough to get things to work. The script is able to achieve minimal downtime by using Microsoft's volume shadow copy service (the script will work only for Windows XP and Windows Server 2003; it may work for Vista as well, if you can find vshadow.exe for it), which you'll have to download (search vss sdk at http://www.microsoft.com/). This script is and adaptation of a script previously posted in this forum by saxa which can be found here: http://communities.vmware.com/thread/54782. Make sure to read all the comments in the beginning and follow any instructions. I haven't tested very thoroughly, so if you find problems, tell me and I can try to fix them. Enjoy! (The script is attached) Do not just run it; save it then right click edit it to read the comments in notepad.

-Zack Nicolaou
Attachments:
Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Nov 28, 2007 4:46 PM
Click to view ktlevy's profile Lurker ktlevy 5 posts since
Nov 28, 2007

I can't seem to get the script to run properly. Whenever I run it, I get the following error:


The Backup Script for VMware Server couldn't create an appropriate connection.
Please check if all of the VMWare Services are up and running.
Please keep in mind, you can run this script on the local host only.

I am running VMware 1.04 and have VMware tools installed on my virtual machine.

Any ideas?

Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 2, 2007 6:27 AM
Click to view Gigaguy's profile Novice Gigaguy 17 posts since
Dec 2, 2007
Where do I get the copyfiles.bat and callback.bat? Can I create them myself? Also, I keep getting the same error as ktlevy when trying to run the script. The script from the original post works fine.

Thanks.
Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 2, 2007 12:25 PM
in response to: Gigaguy
Click to view zgn667's profile Novice zgn667 16 posts since
Oct 26, 2007
copyfiles and callback are created by the script and then deleted after it
runs. What arguments are you calling with the script, or are using the
interactive mode (just double clicking it)? The script is failing to
connect to vmware, but I have the exact same code from the original script.
Try commenting the line "On Error Resume Next" from the script (by opening
it with notepad then edit->go to: Line 64 and adding a ' in front of it,
like the other comments above it) and running it again to see if it will
give you a more detailed message. Tell me what it says then.
Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 2, 2007 12:25 PM
in response to: ktlevy
Click to view zgn667's profile Novice zgn667 16 posts since
Oct 26, 2007
What arguments are you calling with the script, or are using the interactive
mode (just double clicking it)? The script is failing to connect to vmware,
but I have the exact same code from the original script, which seems to
work. Try commenting the line "On Error Resume Next" from the script (by
opening it with notepad then edit->go to: Line 64 and adding a ' in front of
it, like the other comments above it) and running it again to see if it will
give you a more detailed message. Tell me what it says then.
Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 2, 2007 1:56 PM
in response to: zgn667
Click to view Gigaguy's profile Novice Gigaguy 17 posts since
Dec 2, 2007

Ok, I had an error with CDO, so I just commented out all the "mailing" references. Now I am getting a VShadow error. The VM does actually shut down, but never restarts (im guessing because the script errors). The Vshadow error is "The backup script couldn't create a valume shadow or couldn't copy the files from the volume shadow". vshadow.exe is both in my path and the directory I am running the script from. And is enabled for the source drive (Where the VM's are).

Thanks.

Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 2, 2007 2:22 PM
in response to: zgn667
Click to view Gigaguy's profile Novice Gigaguy 17 posts since
Dec 2, 2007

Ok, still having CDO mail issues, but I figured out the issue. My VM drive is E: not C:, the script line 657 is hard-coded to C:. Any idea on how to get email working? I checked google and done all the reinstall, and re-registering of dlls already.

Thanks, Great script !!!!!!

Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 2, 2007 6:35 PM
in response to: Gigaguy
Click to view zgn667's profile Novice zgn667 16 posts since
Oct 26, 2007
Good job debugging, I should have noticed the drive thing when I wrote it.
Anyways, the only problems that I can really think of with the mailing stuff
is maybe you forgot to fill in the smtp variable near the top of the script
(line 72). Whats the specific error you get when you run?
Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 2, 2007 6:56 PM
in response to: zgn667
Click to view zgn667's profile Novice zgn667 16 posts since
Oct 26, 2007
I've updated the script to fix the problem, it now uses the first two letters from the path to the vmx file as the volume shadow drive
Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 3, 2007 7:17 AM
Click to view ktlevy's profile Lurker ktlevy 5 posts since
Nov 28, 2007
I figured out what my problem was. I'm running Windows 2003 R2 Enterprise Edition 64-bit and things were not working properly because the default cscript.exe in c:\windows\system32 was the 64-bit version. Once I made the 32-bit version in c:\windows\syswow64 the default version, the script ran properly. I had also discovered the hardcoded C: issue and changed that to D:
Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 4, 2007 4:56 AM
in response to: ktlevy
Click to view walter81's profile Lurker walter81 4 posts since
Dec 4, 2007

Hi

I'm trying to get this to work, but the Virtual Machine won't shut down. What could be the cause (and are there alternative ways to automaticall shut it off?). We use VMWare Server 1.04 (for as much as that matters)

thanks in advance for any help!

Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 4, 2007 9:39 AM
in response to: walter81
Click to view Gigaguy's profile Novice Gigaguy 17 posts since
Dec 2, 2007
Make sure you have VMTools installed on the Virtual Machine. Also, the suggestion above, to comment out line 64 "On Error Resume Next", will give you a more informative error.
Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 4, 2007 9:19 PM
in response to: walter81
Click to view zgn667's profile Novice zgn667 16 posts since
Oct 26, 2007
If commenting the on error resume next still gives you an indescript the server cannot be shut down, it might be because there is something running on your vm that is preventing it from being shut down. You can try the script on another vm, if possible, or you can make a test script that only tries to shut down the server to see if thats the problem.
Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 5, 2007 12:26 AM
in response to: zgn667
Click to view walter81's profile Lurker walter81 4 posts since
Dec 4, 2007

okay, now I get this output:

C:\scripts>cscript.exe vm-vss-backup.vbs "e:\Virtual Machines\PPS_SR_WSUS\Window
s Server 2003 Standard Edition.vmx"
Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

The Backup Script for VMware Server couldn't create a volume shadow or couldn't
copy the files from the volume shadow.

I did install the Volume Shadow client, and I added the path %programfiles%\....\release-server directory to the %path% variable And I've placed shadow.exe in the script directory.


Reply Re: Backup vbscript for VMWare Server: Only ~1min downtime Dec 5, 2007 4:22 PM
in response to: walter81
Click to view zgn667's profile Novice zgn667 16 posts since
Oct 26, 2007
try from the command line
vshadow c:(or any drive you want)
to see if it has some problem
you can also try vshadow -q to see if there are any existing volume shadows. If there are some and you dont know what they are, they might have been created and then failed to delete. Then you can do vshadow -da to delete any that exists.
1 2 3 4 Previous Next