Veeam, sanal platformlar için otomatik olarak harika yedek alıyor. Bunda hemfikiriz. Fakat bunların restore testlerini otomatik olarak yapmak istediğimizde bir takım yeni lisanslara ihtiyacımız var. Bu yazıda biz, yeni bir maliyete girmeden, teknik bir efor harcarayarak geri dönüş işlemlerini nasıl otomatize ederiz, bunu inceleyeceğiz. Scripti aşağıda veriyorum. Kendinize göre düzeltip yedekleme sunucunuzda dosya bazlı restore’ u gerçekleştirebilir ve hatta bu işlemin bittiğini Event loglardan yakalayıp kendinize mail atabilirsiniz.
<!-- wp:heading {"level":1} --> <h1>Import the Veeam modules</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>Add-PSSnapin VeeamPSSnapin</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Connect to the backup server</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>Connect-VBRServer -Server "backup_server" -User "credential_name" -Password "server_pwd"</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Get backup job values and save them into $backup variable</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>$backup = Get-VBRBackup</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Get restore point values sorted by order and save them into $restorepoint variable</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>$restorepoint = Get-VBRBackup -Name "backup_job_name" | Get-VBRRestorePoint -Name server_name | Sort-Object –Property CreationTime –Descending | Select-Object -First 1</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Start WindowsFileRestore operation</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>$result = Start-VBRWindowsFileRestore -RestorePoint $restorepoint</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Provide credentials</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>$credentials = Get-VBRCredentials -Name "veeam_admin_user"</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Check and save the session which is working</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>$session = Get-VBRRestoreSession | where {$_.IsWorking}</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Start restore session</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>$restore = Start-VBRWindowsGuestItemRestore -Path "path_you_want_to_restore" -Session $session -RestorePolicy Keep -GuestCredentials $credentials</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Stop restore session</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>Stop-VBRWindowsFileRestore $result</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":3} --> <h3>Perform E-mail Notification On Veeam Restore Operation</h3> <!-- /wp:heading --> <!-- wp:heading {"level":1} --> <h1>Check the event IDs in the Windows event logs and save them</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>$InstanceID = "250","251"</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Get the event logs regarding Veeam Backup</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>$event = get-eventlog -LogName "*Veeam Backup" -Source "Veeam MP" -instanceID $InstanceID -newest 1</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Save necessary variables</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>$PCName = $env:COMPUTERNAME<br>$EmailBody = $event | format-list -property * | out-string<br>$EmailFrom = "from_addresss"<br>$EmailTo = "to_address"<br>$EmailSubject = $event.message<br>$SMTPServer = "mail_server"</p> <!-- /wp:paragraph --> <!-- wp:heading {"level":1} --> <h1>Send e-mail that including Veeam restore operation</h1> <!-- /wp:heading --> <!-- wp:paragraph --> <p>Send-MailMessage -From $EmailFrom -To $EmailTo -Subject $EmailSubject -body $EmailBody -SmtpServer $SMTPServer</p> <!-- /wp:paragraph -->
Kolay gelsin.