01/03/2006

Virtual Server 2003 Backup Script

There are not that very many options when it comes to backing up Virtual Servers. Here is a script I came across from the guys at Win32 Scripting that will backup the VMC and VSV. It does require vshadow.exe from the VSS SDK.
Basically it will save state running virtual machines, create a shadow copy , then restore the Virtual Servers.

You can download the script here.


Script:


Script:

On Error Resume Next

Set objShell = CreateObject ("WScript.Shell")
set objFSO=CreateObject("Scripting.FileSystemObject")
Set virtualServer = CreateObject("VirtualServer.Application")
DestBackupDir = "your backup path"
sExCmd = "CreateVSS.cmd"
Set oFileSys = CreateObject("Scripting.FileSystemObject")
if oFileSys.FileExists(sExCmd) then oFileSys.DeleteFile(sExCmd)
set oExCmd = oFileSys.CreateTextFile(sExCmd, CopyOverwrite)

For each objVM in virtualServer.VirtualMachines
'See if vm machine is running. If so then do backup
If objVM.State = 5 then
'Save state the virtual machine
set saveTask = objVM.Save
'Loop waiting for task completion - and display status
while not saveTask.isComplete
WScript.Sleep 1000
wend
'Copy .VMC and .VSV files
MyArray = Split(objVM.File,"\")
Filename = MyArray(Ubound(MyArray))
objFSO.CopyFile objVM.File,DestBackupDir & Filename
MyArray = Split(objVM.SavedStateFilePath,"\")
Filename = MyArray(Ubound(MyArray))
objFSO.CopyFile objVM.SavedStateFilePath,DestBackupDir & Filename
End If
Next
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)

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

' Shutdown all shadow copy instances
if oFileSys.FileExists(sExCmd) then oFileSys.DeleteFile(sExCmd)
set oExCmd = oFileSys.CreateTextFile(sExCmd, CopyOverwrite)
oExCmd.WriteLine "Echo y | vshadow.exe -da"
oExCmd.Close
Result = objShell.run(sExCmd,vbMinimized, TRUE)

'Script ends
wscript.echo "done"

Keep in mind that you still need to copy the VMD file. Also don't forget to add a \ at the end of your backup path ( It will support UNC ).

09/09/2004

Windows 2000 Powered NAS problems

A week ago, our DELL 775N NAS Appliance was constantly slowing down and not allowing network connections to the shares it contained. Initially it reported an Event ID 2021 / 2022. So I removed the Mcafee VScan 7.x and replaced it with VScan 8.x . This seemed to solve the problem for the next few days. Yesterday it started again, this time with an Event ID 2019. So I called up Microsoft and they responded with an untest hofix relating to KB article 833266. After applying this patch, all seems well again with the NAS Appliance. If you like a copy of this patch, please feel free to email me at anytime.

Do remember, alot of times, Windows Powered Appliances do not support the latest hotfixes and updates from Microsoft. Please consult your vendor before making OS changes to your device.

08/12/2004

DNS query responses do not travel through a firewall in Windows Server 2003

Some mailservers behind firewalls ( like mine ) which do not allow transfer of UDP packets larger than 512 bytes may not be able to return the MX record for some ISP like earthlink.net. I came across KB article.

Windows 2003 server has included Extension Mechanisms for DNS (EDNS0) to allow larger packets. If you run this command on a 2003 server: "dnscmd Server Name/Config /EnableEDnsProbes 0", it fixes it without making any changes to the firewall.

Domains with this issue include AOL.com, Qwest.net, and EarthLink.net.

07/29/2004

DNS Intermittently Stops Resolving Some Host Names like Yahoo, Mindspring etc

For the past week, we've had users not being able to send out emails to the likes of Yahoo, Mindspring, Blackberry.net, Verizon Wireless and a few other providers. Now the thing is there was MyDoom attack on some of these sites. Once we verified the domains were up and functional...we tried checking to see if there was a blacklist being used and our domain RUDIN.COM was being blocked. We gave up and started searching within our own internal DNS records.

Randomly, the sites would be resolved if you did an nslookup form the cmd prompt. I finally found out that the cache was not being cleared or is it wasnt clearing it in a timely fashion. So the temporary fix was to go into the Administrator Console and clear the DNS cache. Called up Microsoft and they had a fix to my problem ....A HOTFIX!! - See KB Article 830905.
So tonight I patched our DNS server and miraculously, the Exchange 2003 Mail server started routing all the backed up mail it had in its Queue.

If you have any questions or would like the patch, feel free to email me.

07/28/2004

The Backup Completed, but Some Files Were Skipped

For a month or so, I was doing backups of our Domain Controllers using the Microsoft Backup agent, instead of our usual Veritas 9.x . After a few days, I noticed the following errors with Event ID: 8001

The Backup Completed, but Some Files Were Skipped
Warning: Unable to open "c:\windows\SYSVOL\domain\DO_NOT_REMOVE_NtFrs_PreInstall_Directory" - skipped.
Reason: The process cannot access the file because it is being used by another process.

This problem occurs because the Windows Backup program tries to back up the DO_NOT_REMOVE_NtFrs_PreInstall_Directory folder during the System State backup. To fix this nagging message as it is will not jeapordize the backup I called Microsoft, and they issues a HOTFIX for it.

Feel free to email me for this patch if you're having the same problem.

06/30/2004

More W32Time Errors

Error ID 12 was happening to my Windows 2000 Web Servers, so I had to reconfigure a time source. The previous time source - A Cisco Catalyst Switch was replaced, messing up my time sync. So here is what you do to get rid of that error.

1) Set a chain of SNTP servers to synchronize with via “net time /setsntp: servername”. You can get a list of local servers to synchronize to from the link below.
2) Run the command “w32tm /config /syncfromflags:MANUAL /reliable:YES /update”. This directs Windows to think that the time is reliable on the local server. The only way to get it reliable is to synchronize with the servers as in step 1.

W32Time Errors on your Windows 2003 Domain Controllers

Recently I have been recieving W32Time errors with Event ID 50. Tried setting the net time a couple times but that was pointless. Then i noticed there was a patch available for this particular error. I went ahead, called up Microsoft, and they issues the patch time me immediately. It worked ..got rid of all my W32Time errors.

If you like a copy of this patch ( UNTESTED!! ) please feel free to email me and I will have it available to you.

04/29/2004

Extracting Windows Server 2003 Active Directory-integrated DNS zones to a file

If the DNS zone is a Standard Primary or Secondary zone, the information is already in a .DNS file at %SystemRoot%\System32\Dns.

To extract an Active Directory-integrated zone to a file:

dnscmd /ZoneExport FQDN_ZoneName FileName

Examples
dsncmd /ZoneExport ADMINOTES.COM ADMINNOTES.DNS
exports the ADMINNOTES.COM zone to %SystemRoot%\System32\Dns\ADMINNOTES.DNS.
dnscmd ADMINNOTES /ZoneExport test.ADMINNOTES.COM Test.DNS
exports the test.ADMINNOTES.COM zone on server Adminnotes to %SystemRoot%\System32\Dns\Test.DNS on ADMINNOTES

How do I use a Windows Server 2003 internal root DNS server to provide name resolution for Internet top-level domains ?

Internal root DNS servers do not have root hints and do not forward or resolve any names beyond itself.

If you implement this tip, Down-level DNS servers in your organization are then able to resolve iterative queries to your root DNS servers for top-level domains.

ADMIN's NOTE: You must protect the root DNS server with a firewall.

To delegate all Internet top-level domains:
01. Move %SystemRoot%\System32\DNS\Cache.dns to another folder.
02. Download root.zone.gz from ftp://ftp.rs.internic.net/domain.
03. Extract the root.zone file and rename it Cache.dns. Move it to the %SystemRoot%\System32\DNS folder.
04. Open a CMD prompt on the root DNS server and type:

net stop "dns server"
net start "dns server"

05. Open the DNS snap-in.
06. Right-click Forward Lookup Zone and and press New Zone.
07. Press Next in the New Zone Wizard.
08. Check Primary zone and clear the Store the zone in Active Directory box.
09. Press Next.
10. Type . into the Name box and press Next.
11. Check Use this existing file, type cache.dns, and press Next.
12. Check Do not allow dynamic updates (default) and press Next.
13. Press Finish.

How can I share Help files between Windows XP and Windows Server 2003?

If you administer a Windows Server 2003 domain from a Windows XP Professional computer, you might find it handy to have access to the Windows Server 2003 Help files. Alternately, if you spend most of your time logged onto the console of a Windows Server 2003, you might want access to Windows XP Professional Help files.

To configure Help files for sharing:
1. Start / Help and Support.
2. Press the Options button on the toolbar.

3. In the left-hand pane, press Install and Share Windows Help.

4. In the right-hand pane, press Share your Help content with others on your network.

5. Check the Shared radial button and press Apply.

Install shared Help files from another computer:
1. Start / Help and Support.
2. Press the Options button on the toolbar.

3. In the left-hand pane, press Install and Share Windows Help.

4. In the right-hand pane, press Install Help content from another Windows computer.

5. Type the computer name of the computer that is sharing its' Help content and press the Find button.

6. Select the Help database you wish to install and press Install.

How do I use the additional Help files that I installed?
1. Start / Help and Support.
2. Press the Options button on the toolbar.

3. In the left-hand pane, press Install and Share Windows Help.

4. In the right-hand pane, press Switch from one operating system's Help content to another.

5. Select the Help database that you wish to use and press Switch.

ADMIN's NOTE: You can install the additional help files over the network or from a compact disc.

HOTFIX AND PATCHES

IM me

Sponsors

Search

  • Google

My Online Status

Sponsor

.