Top-Themen

AppleEntwicklungHardwareInternetLinuxMicrosoftMultimediaNetzwerkeOff TopicSicherheitSonstige SystemeVirtualisierungWeiterbildungZusammenarbeit

Aktuelle Themen

Administrator.de FeedbackApache ServerAppleAssemblerAudioAusbildungAuslandBackupBasicBatch & ShellBenchmarksBibliotheken & ToolkitsBlogsCloud-DiensteClusterCMSCPU, RAM, MainboardsCSSC und C++DatenbankenDatenschutzDebianDigitiales FernsehenDNSDrucker und ScannerDSL, VDSLE-BooksE-BusinessE-MailEntwicklungErkennung und -AbwehrExchange ServerFestplatten, SSD, RaidFirewallFlatratesGoogle AndroidGrafikGrafikkarten & MonitoreGroupwareHardwareHosting & HousingHTMLHumor (lol)Hyper-VIconsIDE & EditorenInformationsdiensteInstallationInstant MessagingInternetInternet DomäneniOSISDN & AnaloganschlüsseiTunesJavaJavaScriptKiXtartKVMLAN, WAN, WirelessLinuxLinux DesktopLinux NetzwerkLinux ToolsLinux UserverwaltungLizenzierungMac OS XMicrosoftMicrosoft OfficeMikroTik RouterOSMonitoringMultimediaMultimedia & ZubehörNetzwerkeNetzwerkgrundlagenNetzwerkmanagementNetzwerkprotokolleNotebook & ZubehörNovell NetwareOff TopicOpenOffice, LibreOfficeOutlook & MailPapierkorbPascal und DelphiPeripheriegerätePerlPHPPythonRechtliche FragenRedHat, CentOS, FedoraRouter & RoutingSambaSAN, NAS, DASSchriftartenSchulung & TrainingSEOServerServer-HardwareSicherheitSicherheits-ToolsSicherheitsgrundlagenSolarisSonstige SystemeSoziale NetzwerkeSpeicherkartenStudentenjobs & PraktikumSuche ProjektpartnerSuseSwitche und HubsTipps & TricksTK-Netze & GeräteUbuntuUMTS, EDGE & GPRSUtilitiesVB for ApplicationsVerschlüsselung & ZertifikateVideo & StreamingViren und TrojanerVirtualisierungVisual StudioVmwareVoice over IPWebbrowserWebentwicklungWeiterbildungWindows 7Windows 8Windows 10Windows InstallationWindows MobileWindows NetzwerkWindows ServerWindows SystemdateienWindows ToolsWindows UpdateWindows UserverwaltungWindows VistaWindows XPXenserverXMLZusammenarbeit
GELÖST

VCB 1.5 Trennung von File-Level und Image-Level

Frage Virtualisierung

Mitglied: Passi1985

Passi1985 (Level 1) - Jetzt verbinden

05.11.2008 um 15:04 Uhr, 6252 Aufrufe, 3 Kommentare

Hallo Zusammen,

ist es möglich mit VCB 1.5 ein getrenntes Backup zu erstellen, d.h. file-level und image-level von einer VM?

Wir wollen somit ermöglichen, dass die System Partition als Full-Image gebackuped wird und die Daten Partition nur als File-Backup läuft, so dass wir von dem Backup der Datenpartition jederzeit die Files einzellnt zurücksichern können und das System nur im Notfall Recovern.

Fallbeispiel:
Ich hab meine VM mit C: und D:. Die D ist independent und wird somit nicht im Snapshot berücksichtigt => Beim Backup mit VCB kann ich via Image-Level ein Backup der ganzen VM (C: ohne D: ) erstellen. Nun möchte ich aber noch ein File-Level Backup von D erstellen über VCB, da ich nit übers LAN sichern will. Da die Platte aber independent ist wird sie nicht erkannt.

Hat jemand eine Idee?

Gruß
Pascal
Mitglied: Dracul
15.04.2009 um 14:41 Uhr
Ich mache es auf eine Andere Art und Weise.

die Images sichere ich komprimiert mit einem von mir überarbeiteten VB-Skript direkt vom SAN

die Filesicherung mache ich mit Browse-start / browse-end und kopiere mir die geänderten dateien mit Robocopy in ein Backup-Verzeichnis und von dort auf Band.

Alle Laufwerke (RAW-Devices oder VMDK´s) sind Virtuell und abhängig (die Laufwerke für die Images kann ich angeben und somit werden Riesendateien (z.B. Fileserverdaten) vermieden

01.
  
02.
 
03.
 
04.
'// =========================================================================================== 
05.
'//   BackupDisk.vbs 
06.
'//   ------------------------------------------ 
07.
'//   Uses VCB command line utils, primarily "vcbExport", to do snapshot and perform a full-image 
08.
'//   backup of an *** individual *** VM disk file. 
09.
'// 
10.
'//   Script is designed to be called as "Pre-scan" or "Pre-backup" script by a CommVault sub-client backup job for the VM that is to be backed up 
11.
'// 
12.
'//   This differs from the default vcbMounter.exe utility which enuerates ALL disks in a VM and does  
13.
'//   not enable granular full-image backup of single disk - although it will skip "independent" disks 
14.
'// 
15.
'//   The problem is that if disks are put into independent mode, vcbMounter will also skip them for  
16.
'//   *** File-level *** backups. 
17.
'// 
18.
'//   The "BackupDisk.vbs" script enables selective full-image backup of a specified disk or disks while maintaining 
19.
'//   the ability to perfrom VCB file-level backups of any/all disks within the VM using default VCB scripts  
20.
'// 
21.
'//   It also provides a workaround for the VCB 1.0.2 / ESX 3.0.1 bug that prevents backups of disks on a given VM succedding where that VM 
22.
'//   has multiple disks attached on different LUNs. 
23.
'//    
24.
'//   The script performs the following steps: 
25.
'//   ------------------------------------------ 
26.
'//   =>. Reads the values for the following required command-line parameters: 
27.
'//      * FQDN of target VM where disk to be backed up resides 
28.
'//      * Comma-separated list of the SCSI ID/s of the disk or disks within that VM that should be backed up e.g. "scsi0.0" or "scsi0.0,scsi0.1" 
29.
'//         
30.
'//        IMPORTANT NOTE ON FORMAT OF SCSI ID/s PROVIDED TO COMMAND LINE: 
31.
'//        SCSI IDs should always be provided to the command line in the format "scsi[x].[x]" e.g. "scsi0.0" 
32.
'//        In this instance "scsi0.0" will always be the first disk (System drive for Windows servers), "scsi0.1" will be the second disk etc ... 
33.
'//        The SCSI ID for a disk can be obtained by viewing the properties of the VM in Virtual Center 
34.
'//        However, the display format in Virtual Centre will be as "SCSI ([x].[x])" e.g. "SCSI (0.0)" 
35.
'//        !!!! This format should be changed:  remove all spaces and "(" ")" brackets from the way it is displayed. 
36.
'//        For example, "SCSI (0:0)" should be modified to "scsi0.0" 
37.
'//	 
38.
'//   =>. Gets ID of VM using vcbVmName 
39.
'//   =>. Snapshots the VM using vcbSnapshot 
40.
'//   =>. Runs vcbSnapshot with the "-l" parameter to enumerate the disks within the snapshot 
41.
'//   =>. Checks SCSI ID/s of disk/s passed on command line againsts list of disks within snapshot, and returns path of associated VMDK/s on SAN 
42.
'//   =>. For each disk specified on command line, runs vcbExport to export disk in "compact" and "monolithic" format.  
43.
'//      The export path will be [ROOT_MOUNT_PATH_SPECIFIED_IN_CONFIG.js]\[FQDN_OF_VM]\[ORIGINAL_VMDK_FILE_NAME] 
44.
'//      e.g. D:\MNT\vmtest1.emapdev.net\VMTEST1_1.vmdk 
45.
'//   =>. Runs vcbSnapshot a 3rd time to commit the snapshot (i.e. once vcbExport of all specified disks is complete) 
46.
'//       
47.
'//      POST_EXECUTION ASSUMPTIONS FOR COMMVAULT: 
48.
'//      * It will then be assumed that CommVault will back up the exported disk image from the path specified in step 5 above -  
49.
'//         
50.
'//      * It will also be assumed that CommVault will run a "post-backup" script to DELETE the D:\MNT\[VM Name] directory on the VCB server  
51.
'//        after backup completes 
52.
'// 
53.
'//   Prerequisites: 
54.
'//   ------------------------------------------ 
55.
'//   * VMWare Consolidated Backup Framework 1.0.x must be installed on system where script is executed 
56.
'//   * The script MUST be located in the VCB_PROXY_FRAMEWORK_INSTALL_DIR\generic folder - along with the other .wsf, .js and .bat files 
57.
'//     By default this is "C:\Program Files\VMware\VMware Consolidated Backup Framework\generic" 
58.
'//   * The config.js file must be correctly configured as per VMWare / CommVault / Emap requirements 
59.
'//   * The constant "VCB_INSTALL_PATH" within the script below must be modified to reflect the location of the VCB executables (vcbExport, vcbSnapshot, vcbVmName etc) 
60.
'// 
61.
'//   Other notes: 
62.
'//   ------------------------------------------ 
63.
'//   As per any VCB-based backup, only one backup of the VM specified should be run at any one time (stands to reason) 
64.
'//    
65.
'//   Usage / Syntax: 
66.
'//   ------------------------------------------ 
67.
'//   VMbackup.vbs [FQDN_OF_VM] [COMMA_SEP_LIST_OF_SCSI_IDs_FOR_DISKS_TO_BACKUP] 
68.
'//    
69.
'//   Examples: 
70.
'//   ------------------------------------------ 
71.
'//   To backup disk 0 on VM "vcbtest1.emapdev.net": 
72.
'//   BackupDisk.vbs vcbtest1.emapdev.net scsi0.0 
73.
'// 
74.
'//   To backup disks 0 and 1 on VM "server1.emap.net": 
75.
'//   BackupDisk.vbs server1.emap.net scsi0.0,scsi0.1 
76.
'// 
77.
'//   Restoring vcbExport backups made with this script: 
78.
'//   ------------------------------------------ 
79.
'//   The compact, monolithic .VMDK files created by this script as individual disk backups can be restored by using "vmkfstools -i" on any ESX service console 
80.
'//   The VMDK backup file should be: 
81.
'//   1. Restored to the VCB server local disk using CommVault 
82.
'//   2. Copied to a temp location on one of the ESX servers in the correct VI cluster 
83.
'//   3. Then imported to the correct folder for the target VM (existing or new) using "vmkfstools -i [RESTORED_DISK_FILE_PATH] [TARGET_DISK_FILE_PATH] 
84.
'//   4. Finally, the imported vmdk file should be re-added to the correct VM using ESX command line or Virtual Infrastructure client 
85.
'// 
86.
'//   AUTHOR: Justin Turver, 09/2007 
87.
'// =========================================================================================== 
88.
'// 
89.
'// Changes HIERL 01/2009 
90.
'// 
91.
'// usage of VM-Ware names 
92.
'// 
93.
'// wegen Zertifikatsproblemen den namen "VMware" umgeleitet auf den VC (Host entry xx.xx.xx.xx VMware) (Funktioniert) 
94.
'// SSL einschalten: 
95.
'// [HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Consolidated Backup] 
96.
'// "VerifySSLCertificates"=dword:00000001 
97.
'// SSL ausschalten: 
98.
'// [HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Consolidated Backup] 
99.
'// "VerifySSLCertificates"=dword:00000000 
100.
'//  
101.
'// Beispiel: 
102.
'// @ECHO OFF 
103.
'// echo ######## 1/19 Vitrual Center ################################# 
104.
'// @echo on 
105.
'// cscript /nologo "d:\vcb\generic\BackupDisk.vbs" "EC084479 VC" "scsi0.0,scsi0.1" 
106.
'// @ECHO OFF 
107.
'// echo -------------------------------------------------------------- 
108.
'// echo ######## 2/19 Nagios ######################################### 
109.
'// @echo on 
110.
'// cscript /nologo "d:\vcb\generic\BackupDisk.vbs" "Nagios" "scsi0.0" 
111.
'// @echo off 
112.
'//  
113.
Option Explicit 
114.
 
115.
'// ----------------------------------------------------------------------------------- 
116.
'//                Constants - change to reflect running environment: 
117.
'// ----------------------------------------------------------------------------------- 
118.
Const VCB_INSTALL_PATH = "D:\VCB" 
119.
Const HOST = "VMware"  
120.
Const USERNAME = "Administrator" 
121.
Const PASSWORD = "***********" 
122.
Const BACKUPROOT = "K:\\mnt" 
123.
Const SNAPSHOTNAME = "_VCB-BACKUP_" 
124.
Const CONTINUE_IF_VCB_SNAP_FOUND = True		'// Set to true to proceed with backup/export even if there's an existing snapshot of the VM 
125.
Const CONTINUE_IF_BACKUP_DIR_FOUND = True	'// Set to true to proceed with backup/export even if the local backup target directory already exists 
126.
'// ----------------------------------------------------------------------------------- 
127.
 
128.
Const EVT_SUCCESS = 0 
129.
Const EVT_ERROR = 1 
130.
Const EVT_WARN = 2 
131.
Const EVT_INFO = 4 
132.
 
133.
'// Global Variables 
134.
'// ---------------- 
135.
Dim oArgs, oWshShell, oExec, oDict, oDictItem, colKeys, oFSO, oBackupFolder 
136.
Dim aDisksToBackUp, aSSIDs 
137.
Dim iRetVal, i 
138.
Dim sVMFQDN, sOutput, sCommandPath, sVmID, sSSID, sSnapNumber, sSnapDelete, sSnapCreate, sDisk, sDisks, sDiskPath, sDiskFile, sKey, sPercentExportComplete 
139.
Dim bDiskCheck 
140.
Dim start 
141.
 
142.
'// Create global objects 
143.
'// --------------------- 
144.
Set oWshShell = CreateObject("WScript.Shell") 
145.
Set oDict = CreateObject("Scripting.Dictionary") 
146.
Set oFSO = CreateObject("Scripting.FileSystemObject") 
147.
 
148.
 
149.
'// ============================================== 
150.
'//                START MAIN: 
151.
'// ============================================== 
152.
start = Now() 
153.
LogInfo( "EMAP vcbEXPORT: Starting backup using " & WScript.ScriptFullName ) 
154.
 
155.
 
156.
'// ============================================== 
157.
'// 1. Get / check command line params: 
158.
'// ============================================== 
159.
LogInfo( "EMAP vcbEXPORT task 1: Checking command-line params for Emap custom VCB Backup script " & WScript.ScriptFullName ) 
160.
Set oArgs = WScript.Arguments 
161.
If oArgs.Count = 2 Then 
162.
	sVMFQDN = Trim((WScript.Arguments(0))) 
163.
   ' //     sVMFQDN = chr(34) & sVMFQDN & chr(34) 
164.
	On Error Resume Next 
165.
	 
166.
	'// aDisksToBackup enthält alle einträge der zu sichernden Daten [1..x] 
167.
	aDisksToBackUp = Split(LCase(WScript.Arguments(1)),",") 
168.
	If Err Then 
169.
		LogError("EMAP vcbEXPORT task 1: ERROR: Invalid command-line argument specified for 'disk/s' paramter. ERROR: " & Err.Number & "-" & Err.Description & ". VM: " & sVMFQDN) 
170.
		LogError("Expected Syntax = [script_name] [fqdn_of_vm_to_backup] [comma-separated_list_of_disk_scsi_IDs] e.g. '" & WScript.ScriptName & " mytestvm.emapdev.net scsi0.0,scsi0.1'. VCB BACKUP FAILED!") 
171.
		WScript.Quit(1) 
172.
	End If 
173.
	On Error Goto 0 
174.
Else 
175.
	LogError("EMAP vcbEXPORT task 1: ERROR: Invalid command line arguments specified. Syntax = [script_name] [fqdn_of_vm_to_backup] [comma-separated_list_of_disk_scsi_IDs]. VM: " & sVMFQDN & ". VCB BACKUP FAILED!") 
176.
	WScript.Quit(1) 
177.
End If 
178.
Set oArgs = Nothing 
179.
LogInfo( "EMAP vcbEXPORT task 1: Command line successfully parsed. Will attempt to backup server '" & sVMFQDN & "'. The following disks on this server will be backed up: " & WScript.Arguments(1)) 
180.
 
181.
 
182.
'// ============================================== 
183.
'// 2. Get ID of VM for use when creating snapshot 
184.
'// ============================================== 
185.
oWshShell.LogEvent EVT_INFO, "EMAP vcbEXPORT task 2: Retrieving VM ID of server '" & sVMFQDN & "' for vcbBackup." 
186.
'// HIE Org mit IPAdresse 
187.
'// sVmID = RunCommand(VCB_INSTALL_PATH & "\vcbVmName.exe -h " & HOST & " -u " & USERNAME & " -p " & PASSWORD & " -s ipaddr:" & sVMFQDN,"moref:",False) 
188.
'//  
189.
sVmID = RunCommand(VCB_INSTALL_PATH & "\vcbVmName.exe -h " & HOST & " -u " & USERNAME & " -p " & PASSWORD & " -s Name:" & chr(34) & sVMFQDN & chr(34)  ,"moref:" ,False) 
190.
If Len(Trim(sVmID)) < 10 Then 
191.
	LogError("EMAP vcbEXPORT task 2: UNKNOWN ERROR: vcbVmName could did not return the vm-ID for VM: " & sVMFQDN & ":" & sVmID & ". VCB BACKUP FAILED!" & vbCrLf & vbCrLf & sOutput) 
192.
	WScript.Quit(1) 
193.
End If 
194.
LogInfo( "EMAP vcbEXPORT task 2: ID of VM '" & sVMFQDN & "' returned successfully: " & sVmID & vbCrLf & vbCrLf & sOutput) 
195.
sOutput = "" 
196.
 
197.
 
198.
'// ========================================================================== 
199.
'// 3.Create backup folder for VM at designated local mount point (BACKUPROOT) 
200.
'// ========================================================================== 
201.
'// Check if backup folder on vcb proxy server (subfolder to default mount point) exists: 
202.
LogInfo( "EMAP vcbEXPORT task 3: Creating backup folder for '" & sVMFQDN & "' at root path '" & BACKUPROOT & "'.") 
203.
If oFSO.FolderExists(BACKUPROOT & "\" & sVMFQDN & "-CustomDiskBackup") Then 
204.
	If CONTINUE_IF_BACKUP_DIR_FOUND = True Then '// Proceed with backup anyway - remove existing folder and continue 
205.
		'// Log warning as old backup may not have run post-backup cleaup script (post-backup) 
206.
		LogInfo( "EMAP vcbEXPORT task 3: WARNING: vcb export backup folder already exists for VM '" & sVMFQDN & "' at path: '" & BACKUPROOT & "\" & sVMFQDN & "' and 'CONTINUE_IF_BACKUP_DIR_FOUND = True' - will proceed and remove existing backup directory and current backup will continue. NOTE: This folder should have been removed by post-backup script. Check that the correct post-backup script exists for CommVault backup of this server. The fact that it's still there may also mean that the previous backup of this VM failed, or the post-backup script failed. Please check this out. Script " & WScript.ScriptFullName & " will continue to delete the existing directory and all files within. VCB BACKUP WARNING!") 
207.
		'// Try and remove the existing folder and contents 
208.
		On Error Resume Next 
209.
		Set oBackupFolder = oFSO.GetFolder(BACKUPROOT & "\" & sVMFQDN & "-CustomDiskBackup") 
210.
		oBackupFolder.Delete  ', True 
211.
		If Err Then 
212.
			LogError("EMAP vcbEXPORT task 3: ERROR: Unable to delete an existing vcb export folder '" & BACKUPROOT & "\" & sVMFQDN & "'.for VM '" & sVMFQDN & "'. Check that another backup is not running, or that the folder or files within are not otherwise locked!!!. Error: " & Err.Number & "--" & Err.Description & ". VCB BACKUP FAILED!") 
213.
			WScript.Quit(1) 
214.
		End If 
215.
		On Error Goto 0 
216.
		Set oBackupFolder = Nothing 
217.
		WScript.Sleep 2000 
218.
	Else 
219.
		'// Cancel backup ... 
220.
		LogError("EMAP vcbEXPORT task 3: ERROR: backup target folder for VM '" & BACKUPROOT & "\" & sVMFQDN & "'already exists, and 'CONTINUE_IF_BACKUP_DIR_FOUND' is set to 'FALSE'. Check that another backup is not running, and that any CommVault backup jobs for this VM have the correct post-backup script assigned so that backup directories or mount points for this VM are removed properly once backup is complete. Backup cannot continue for this VM. VCB BACKUP FAILED!") 
221.
		WScript.Quit(1) 
222.
	End If 
223.
End If 
224.
'// Create backup folder for the VM at the specified mount point root 'BACKUPROOT' 
225.
On Error Resume Next 
226.
Set oBackupFolder = oFSO.CreateFolder(BACKUPROOT & "\" & sVMFQDN & "-CustomDiskBackup") 
227.
If Err Then 
228.
	LogError("EMAP vcbEXPORT task 3: ERROR: Unable to create local vcb export folder '" & BACKUPROOT & "\" & sVMFQDN & "-CustomDiskBackup" & "'.for VM '" & sVMFQDN & "'. Check that another backup is not running, and that the folder does not already exist in a locked state!!!. Error: " & Err.Number & "--" & Err.Description & ". Backup cannot continue for this disk. VCB BACKUP FAILED!") 
229.
	WScript.Quit(1) 
230.
Else 
231.
	LogInfo( "EMAP vcbEXPORT task 3: Backup folder for VM '" & sVMFQDN & "' created successfully at '" & BACKUPROOT & "\" & sVMFQDN & "-CustomDiskBackup" & "'.") 
232.
End If 
233.
On Error Goto 0 
234.
Set oBackupFolder = Nothing 
235.
 
236.
 
237.
'// ============================================== 
238.
'//      4. Check for existing vcbSnapshots  
239.
'// ============================================== 
240.
LogInfo("EMAP vcbEXPORT task 4: Checking for existing VCB snapshots ('_VCB-BACKUP_') for VM: " & sVMFQDN) 
241.
sSSID = RunCommand(VCB_INSTALL_PATH & "\vcbSnapshot.exe -h " & HOST & " -u " & USERNAME & " -p " &  "*******"  & " -f " & sVmID & " " & SNAPSHOTNAME, "ssid:",False) 
242.
If (InStr(LCase(sOutput),"no backup snapshots found") > 0) Or (InStr(LCase(sSSID),"ssid:snapshot") = 0) Then 
243.
	'// No VCB snapshots found 
244.
	LogInfo( "EMAP vcbEXPORT task 4: No existing VCB Snapshots found for VM: " & sVMFQDN & ". Backup will proceed.") 
245.
Else 
246.
	'// Existing VCB snapshots found 
247.
	If CONTINUE_IF_VCB_SNAP_FOUND = True Then 
248.
		LogInfo( "EMAP vcbEXPORT task 4: Existing VCB Snapshots found for VM: " & sVMFQDN & ", and 'CONTINUE_IF_VCB_SNAP_FOUND = True' - proceeding to delete existing VCB snapshot ...") 
249.
		'// Delete existing VCB snap/s, and continue backup 
250.
		sSnapDelete = RunCommand(VCB_INSTALL_PATH & "\vcbSnapshot.exe -h " & HOST & " -u " & USERNAME & " -p " & PASSWORD & " -d " & sVmID & " " & sSSID, "error",False) 
251.
		'// Scheiß Error wegen Certifikat HIE 
252.
		If InStr(LCase(sSnapDelete), "error") Then  
253.
			LogError("EMAP vcbEXPORT task 4: ERROR: Cannot delete existing snapshot: " & sVMFQDN & ": " & sSSID & ". VCB BACKUP FAILED!" & vbCrLf & vbCrLf & sOutput) 
254.
			WScript.Quit(1) 
255.
		Else 
256.
			LogInfo( "EMAP vcbEXPORT task 4: Existing snapshot of VM '" & sVMFQDN & "', VMID=" & sVmID & ", SSID=" & sSSID & " - deleted successfully." & vbCrLf & vbCrLf & sOutput) 
257.
		End If 
258.
		WScript.Sleep 5000 
259.
	Else 
260.
		'// Log error and fail backup .. 
261.
		LogError("EMAP vcbEXPORT task 4: ERROR: Existing VCB Snapshots found for VM: " & sVMFQDN & ", and 'CONTINUE_IF_VCB_SNAP_FOUND = False', so backup will not proceed. VCB BACKUP FAILED!" & vbCrLf & vbCrLf & sOutput) 
262.
		Err.Clear 
263.
		WScript.Quit(1) 
264.
	End If 
265.
End If 
266.
sOutput = "" 
267.
sSSID = "" 
268.
 
269.
 
270.
'// =============================================== 
271.
'// 5. Create snapshot of the vm specified by VmID 
272.
'// =============================================== 
273.
LogInfo( "EMAP vcbEXPORT task 5: Creating snapshot of VM '" & sVMFQDN & "' for vcbBackup.") 
274.
sSSID = RunCommand(VCB_INSTALL_PATH & "\vcbSnapshot.exe -h " & HOST & " -u " & USERNAME & " -p " & PASSWORD & " -c " & sVmID & " " & SNAPSHOTNAME, "ssid",False) 
275.
'//If (Len(Trim(sSSID)) < 10) Or (InStr(LCase(sOutput), "error") > 1 ) Then 
276.
If Len(Trim(sSSID)) < 10  Then 
277.
	LogError("EMAP vcbEXPORT task 5: UNKNOWN ERROR: vcbSnapshot did not successfully snapshot the VM: " & sVMFQDN & ". VCB BACKUP FAILED!" & vbCrLf & vbCrLf & sOutput) 
278.
	WScript.Quit(1) 
279.
Else 
280.
	LogInfo( "EMAP vcbEXPORT task 5: Snapshot of VM '" & sVMFQDN & "' created successfully. Snapshot ID: " & sSSID & vbCrLf & vbCrLf & sOutput	) 
281.
End If 
282.
sOutput = "" 
283.
 
284.
 
285.
'// ================================================================== 
286.
'//  6. Get paths for source disks on SAN ready for vcbExport backup 
287.
'// ================================================================== 
288.
 
289.
LogInfo( "EMAP vcbEXPORT task 6: Retreiving SAN paths for VM disk/s to be backed up for VM '" & sVMFQDN & "'") 
290.
 
291.
'// Get dictionary object holding paths of all disks in the snapshot ... 
292.
'// NOTE that the "True" parameter at the end fo the following command instructs the "RunCommand" function 
293.
'// to add all matches to a dictionary object/array (global variable "oDict"), rather than just returning a single string match 
294.
sDisks = RunCommand(VCB_INSTALL_PATH & "\vcbSnapshot.exe -h " & HOST & " -u " & USERNAME & " -p " & PASSWORD & " -l " & sVmID & " " & sSSID, "scsi", True) 
295.
 
296.
'// Scheiß Error wegen Certifikat HIE 
297.
' HIE Prüfung auf SSL-Zertifikat einschalten 
298.
oWshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Consolidated Backup\VerifySSLCertificates",1,"REG_DWORD" 
299.
If Err.Number <> 0 then 
300.
	LogError(" Fehler beim Ändern der Registry (VerifySSLCertificates) auf 1 " + VbCrLf + "oWshShell.RegWrite HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Consolidated Backup\VerifySSLCertificates,1,REG_DWORD") 
301.
end if 
302.
 
303.
If (InStr(LCase(sOutput), "error") > 0) Then 
304.
	LogError("EMAP vcbEXPORT task 6: UNKNOWN ERROR: vcbSnapshot did not successfully list disks in : " & sSSID & " for VM: " & sVMFQDN & ". VCB BACKUP FAILED!" & vbCrLf & vbCrLf & sOutput) 
305.
	WScript.Quit(1) 
306.
Else 
307.
	LogInfo( "EMAP vcbEXPORT task 6: Successfully listed disks in snapshot for VM '" & sVMFQDN & "' for snapshot " & sSSID & vbCrLf & vbCrLf & sOutput	) 
308.
End If 
309.
 
310.
sOutput = "" 
311.
colKeys = oDict.Keys 
312.
'// ================================================================== 
313.
'//  7. Then run vcbExport to export the disk file to the specified  
314.
'//     mount point 
315.
'// ================================================================== 
316.
'// For each disk specified for backup on the commane line: 
317.
For i = 0 To UBound(aDisksToBackUp) 
318.
	'// Check to see if the disk exists in the snapshot using "vcbSnapshot -l" 
319.
	'// If it does, obtain the corresponding SAN path from the output of "vcbSnapShot -l"  
320.
	'// by removing the "scsiX.X:" part of the string 
321.
	'// The remaining portion of the string which is obtained is the correct  
322.
	'// source-path path for the disk as it should be passed to the vcbExport command 
323.
	bDiskCheck = False 
324.
	sDiskPath = "" 
325.
	sDiskFile = "" 
326.
	'// Get full path of disk in correct case ... 
327.
	For Each sKey in oDict.Items 
328.
	    sDisk = Trim(oDict.Item(sKey)) 
329.
	    If InStr(sDisk, aDisksToBackUp(i)) Then 
330.
	    	sDiskPath = Mid(sDisk,InStr(sDisk,":")+1, Len(sDisk)-InStr(sDisk,":")) 
331.
	    	bDiskCheck = True 
332.
	    End If 
333.
	Next 
334.
	'// If SAN path for disk is returned successfully, run vcbExport for the disk: 
335.
	If (bDiskCheck = True) And InStr(LCase(sDiskPath),(".vmdk")) Then 
336.
		'// Try export  ################################################################################### 
337.
		sDiskFile = Trim(Mid(sDiskPath,InStrRev(sDiskPath, "/")+1,Len(sDiskPath)-InStrRev(sDiskPath, "/"))) 
338.
		LogInfo( "EMAP vcbEXPORT task 7: Running vcbExport to backup disk '" & sDiskPath & "' for VM '" & sVMFQDN & "'") 
339.
		sSnapNumber = Mid(sSSID,InStr(sSSID,":")+1, Len(sSSID)-InStr(sSSID,":")) 
340.
		sPercentExportComplete = RunCommand(VCB_INSTALL_PATH & "\vcbExport.exe -M 1 -d " & chr(34) &BACKUPROOT & "\" & sVMFQDN & "-CustomDiskBackup\" & sDiskFile & CHR(34) & " -s " & Chr(34) & "blklst://" & sSnapNumber & sDiskPath & "@" & HOST & "?" & USERNAME & "/" & PASSWORD & Chr(34),"100%",False) 
341.
		If (InStr(sPercentExportComplete, "100%") > 0) And (InStr(LCase(sOutput),"error") < 1) Then 
342.
			'// Export ** should ** have worked ... 
343.
			'// Check file size on disk to make sure ... 
344.
			LogSuccess( "EMAP vcbEXPORT task 7: vcbExport of disk '" & sDiskPath & "' to path '" &  BACKUPROOT & "\" & sVMFQDN & "\" & sDiskFile & "', for VM '" & sVMFQDN & "' completed successfully!" & vbCrLf & vbCrLf & sOutput) 
345.
		Else 
346.
			'// Export failed .... 
347.
			LogError("EMAP vcbEXPORT task 7: ERROR: vcbExport of disk '" & sDiskPath & "' to path '" &  BACKUPROOT & "\" & sVMFQDN & "\" & sDiskFile & "', For VM '" & sVMFQDN & "' failed! VCB BACKUP FAILED for this disk!" & vbCrLf & vbCrLf & sOutput) 
348.
		End If 
349.
	Else 
350.
		'// Fail backup for this disk - cannot proceed without correct source path of disk to backup 
351.
		LogError("ERROR: " & sVMFQDN & "EMAP vcbEXPORT task 7: Unable to obtain source path on SAN for disk " & sDisk & ". This disk will NOT be backed up! VCB BACKUP FAILED for this disk!" & vbCrLf & vbCrLf & sOutput) 
352.
	End If 
353.
	sOutput = "" 
354.
Next 
355.
' HIE Prüfung auf SSL-Zertifikat wieder ausschalten 
356.
oWshShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Consolidated Backup\VerifySSLCertificates",0,"REG_DWORD" 
357.
If Err.Number <> 0 then 
358.
	LogError(" Fehler beim Ändern der Registry (VerifySSLCertificates) auf 0 " + VbCrLf + "oWshShell.RegWrite HKEY_LOCAL_MACHINE\SOFTWARE\VMware, Inc.\VMware Consolidated Backup\VerifySSLCertificates,0,REG_DWORD") 
359.
end if 
360.
'// For debug 
361.
sOutput = "" 
362.
363.
'//############################################################################################ 
364.
 
365.
 
366.
'// ================================================================== 
367.
'//       8. Remove snapshot once disk export is complete 
368.
'// ================================================================== 
369.
WScript.Sleep 5000 
370.
LogInfo( "EMAP vcbEXPORT task 8: POST DISK EXPORT (vcbExport) CLEANUP: Removing snapshot of VM '" & sVMFQDN & "' for vcbBackup.") 
371.
sSSID = RunCommand(VCB_INSTALL_PATH & "\vcbSnapshot.exe -h " & HOST & " -u " & USERNAME & " -p " & PASSWORD & " -d " & sVmID & " " & sSSID, "error",False) 
372.
If InStr(LCase(sSnapDelete), "error") Then  
373.
	LogError("EMAP vcbEXPORT task 8: ERROR: Cannot delete existing snapshot: " & sVMFQDN & ": " & sSSID & ". VCB BACKUP FAILED!" & vbCrLf & vbCrLf & sOutput) 
374.
Else 
375.
	LogInfo( "EMAP vcbEXPORT task 8: POST DISK EXPORT (vcbExport) CLEANUP: Existing snapshot of VM '" & sVMFQDN & "', VMID=" & sVmID & ", SSID=" & sSSID & " - deleted successfully." & vbCrLf & vbCrLf & sOutput) 
376.
End If 
377.
 
378.
 
379.
'// ====================== 
380.
'//    BACKUP COMPLETE 
381.
'// ====================== 
382.
LogInfo( "EMAP vcbEXPORT: backup of VM '" & sVMFQDN & "' COMPLETE!") 
383.
 
384.
 
385.
'// ===================== 
386.
'//       Clean up 
387.
'// ===================== 
388.
Set oFSO = Nothing 
389.
Set oDict = Nothing 
390.
Set oWshShell = Nothing 
391.
 
392.
 
393.
'// =========================== 
394.
'//          FUNCTIONS 
395.
'// =========================== 
396.
Function RunCommand(sPath, sSearchVal, bAddToDict) 
397.
	Dim sRetVal, oExecRun, sLineText, sStdErr 
398.
	LogCommand("*****RunCommand:" & sPath) 
399.
	oWshShell.LogEvent EVT_INFO, sVMFQDN & ": Running command '" & sPath & "'" 
400.
	Set oExecRun = oWshShell.Exec(sPath) 
401.
	If Err Then 
402.
		LogError("ERROR: Error executing command: '" & sPath & "'. " & Err.Number & "-" & Err.Description & ". VM: " & sVMFQDN & ". VCB BACKUP FAILED!") 
403.
		WScript.Quit(1) 
404.
	End If 
405.
	On Error Goto 0 
406.
	Do While oExecRun.Status = 0 
407.
		WScript.Sleep 100 
408.
	Loop 
409.
	Do Until oExecRun.StdOut.AtEndOfStream 
410.
		sLineText = oExecRun.StdOut.ReadLine 
411.
		If InStr(LCase(sLineText), LCase(sSearchVal)) Then 
412.
			sRetVal = Trim(sLineText) 
413.
			If bAddToDict = True Then 
414.
				'// Add all matches to array (global dictionary object 'oDict') 
415.
				oDict.Add sRetVal,sRetVal 
416.
			End If 
417.
		End If 
418.
		sOutput = sOutput & vbCrLf & sLineText 
419.
		sLineText = "" 
420.
	Loop 
421.
	sStdErr = Trim(oExecRun.StdErr.ReadAll) 
422.
	If Len(Trim(sStdErr)) > 0 Then 
423.
		LogError("ERROR: Error returned running command '" & sPath & "' for VM: "& sVMFQDN & ". Error: " & sStdErr & ". Backup ** may ** have failed for this VM!") 
424.
	End If 
425.
	LogInfo("******* Antwort:" & sRetVal) 
426.
	Set oExecRun = Nothing 
427.
	RunCommand = sRetVal 
428.
End Function 
429.
 
430.
Function LogCommand(sMsg) 
431.
' kein Eintrag in Evt-log wegen Passwort 
432.
	Dim oShell 
433.
	sMsg = "INFO (+" & Dauer & " s):" & sMsg 
434.
	Set oShell = CreateObject("WScript.Shell") 
435.
	WScript.StdOut.WriteLine sMsg 
436.
	Set oShell = Nothing 
437.
End Function 
438.
 
439.
Function LogError(sMsg) 
440.
	Dim oShell 
441.
	sMsg = "Error (+" & Dauer & " s):" & sMsg 
442.
	Set oShell = CreateObject("WScript.Shell") 
443.
	WScript.StdOut.WriteLine  sMsg 
444.
	oWshShell.LogEvent EVT_ERROR, sMsg 
445.
	Set oShell = Nothing 
446.
End Function 
447.
 
448.
Function LogInfo(sMsg) 
449.
	Dim oShell 
450.
	sMsg = "INFO (+" & Dauer & " s):" & sMsg 
451.
	Set oShell = CreateObject("WScript.Shell") 
452.
	WScript.StdOut.WriteLine sMsg 
453.
	oWshShell.LogEvent EVT_INFO, sMsg 
454.
	Set oShell = Nothing 
455.
End Function 
456.
 
457.
Function LogSuccess(sMsg) 
458.
	Dim oShell 
459.
	sMsg = "ERFOLG (+" & Dauer & " s):" & sMsg 
460.
	Set oShell = CreateObject("WScript.Shell") 
461.
	WScript.StdOut.WriteLine  sMsg 
462.
	oWshShell.LogEvent EVT_SUCCESS,sMsg 
463.
	Set oShell = Nothing 
464.
End Function 
465.
 
466.
Function Dauer 
467.
	Dauer = DateDiff("s",start,Now()) 
468.
End Function 
469.
 
Bitte warten ..
Mitglied: Passi1985
15.04.2009 um 18:26 Uhr
Danke für dein Script. Werds mal durchtesten und dann nochmal bescheid geben wie's läuft!

Gruß
Pascal
Bitte warten ..
Mitglied: Dracul
26.05.2009 um 18:28 Uhr
Hi Pascal

ich habe die neue Version incl. alles damit zusammenhängende dort geposted.

neu dabei ist daß die VMX* files jetzt auch gesichert werden

http://viops.vmware.com/home/message/2186

Gruß Dracul
Bitte warten ..
Neuester Wissensbeitrag
Windows 10

Powershell 5 BSOD

(8)

Tipp von agowa338 zum Thema Windows 10 ...

Ähnliche Inhalte
Heiß diskutierte Inhalte
Microsoft
Ordner mit LW-Buchstaben versehen und benennen (20)

Frage von Xaero1982 zum Thema Microsoft ...

Outlook & Mail
gelöst Outlook 2010 findet ost datei nicht (19)

Frage von Floh21 zum Thema Outlook & Mail ...

Netzwerkmanagement
gelöst Anregungen, kleiner Betrieb, IT-Umgebung (18)

Frage von Unwichtig zum Thema Netzwerkmanagement ...

Festplatten, SSD, Raid
M.2 SSD wird nicht erkannt (14)

Frage von uridium69 zum Thema Festplatten, SSD, Raid ...