{"id":312,"date":"2017-07-20T09:33:40","date_gmt":"2017-07-20T07:33:40","guid":{"rendered":"https:\/\/itblogwildi.wordpress.com\/?p=312"},"modified":"2017-07-20T09:33:40","modified_gmt":"2017-07-20T07:33:40","slug":"veeam-backup-and-replication-9-5-free-automate-backup-with-powershell","status":"publish","type":"post","link":"https:\/\/itblog.wildi.dk\/?p=312","title":{"rendered":"Veeam Backup and Replication 9.5 Free: Automate Backup with PowerShell"},"content":{"rendered":"<p>Ich sichere meinen Labor-Exchange-Server seit neustem mit\u00a0Veeam Backup and Replication 9.5 Free, \u00fcber ein PowerShell Script (von <a href=\"https:\/\/github.com\/maxthauer\/Backups4Days\/tree\/master\/Veeam%20Backup%20and%20Replication\" target=\"_blank\" rel=\"noopener\">hier<\/a>). Ich habe das Script ein wenig angepasst, da es im Original nicht funktionierte:<\/p>\n<pre># PowerShell script to backup VMware or Hyper-V Environments using Veeam Backup and Replication\n# The PowerShell extension for this is included by default in version 9.0\n\n###### Modify these variables to fit your environment #####\n$target = \"SRV02\" # vCenter, ESXi or Hyper-V IP Address\n$account = \"labor\\svc_veeam\" # Account with full permissions for $target and $dest\n$VMs = \"SRV93\" # VM name, only one VM per VeeamZip in the free edition\n$dest = \"\\\\srv02\\VeeamZIP\\daily\" # UNC path for backups \n$retention = \"In2days\" #Retention time: Never, Tonight, In2days, In2Weeks, In1Month\n# Add -DisableQuiesce after the $vm variable in the Start-VBRZip command if you have issues\n#############################################################\n\n# Add the Veeam Backup and Replication Snap-in\nAdd-PSSnapin VeeamPSSnapin\n\n# Disconnect from Veeam Backup and Replication server in case it is already connected\nDisconnect-VBRServer\n\n# Connect to the Veeam Backup and Replication server (localhost)\nConnect-VBRServer\n\n# Set server equal to the VMware or Hyper-V Server\n#$server = Get-VBRServer -Name $target\n\n# Get credentials we specified in Veeam GUI\n$creds = Get-VBRCredentials -Name $account\n\n# Entity which we are backing up, contains server and VM names\n# Find-VBRViEntity (for VMware) or Find-VBRHvEntity (for Hyper-V)\n$vm = Find-VBRHvEntity -Name $VMs -Server $target\n\n# Encryption key added in Veeam GUI\n$key = Get-VBREncryptionKey\n\n# Start VeeamZip job\nStart-VBRZip -Folder $dest -Entity $vm -RunAsync #-AutoDelete $retention -DisableQuiesce\n\n# If you want to use a local path instead:\n# Start-VBRZip -Folder \"C:\\Backup\" -Entity $vm $vm -EncryptionKey $key -AutoDelete $retention -RunAsync\n\n# Take a nap\nSleep 5\n\n# Disconnect once job is submitted\nDisconnect-VBRServer<\/pre>\n<p>Auf dem Verzeichnis &#171;VeeamZIP&#187; muss dem Computer, auf welchem VEEAM l\u00e4uft, via Freigabe und NTFS Zugriff erteilt werden!<\/p>\n<p>Das Script wird dann via TaskScheduler ausgef\u00fchrt.<\/p>\n<p>Folgende Optionen sind gesetzt:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-325\" src=\"https:\/\/itblog.wildi.dk\/wp-content\/uploads\/2017\/07\/veeam01.jpg\" alt=\"Veeam01\" width=\"786\" height=\"277\" srcset=\"https:\/\/itblog.wildi.dk\/wp-content\/uploads\/2017\/07\/veeam01.jpg 786w, https:\/\/itblog.wildi.dk\/wp-content\/uploads\/2017\/07\/veeam01-300x106.jpg 300w, https:\/\/itblog.wildi.dk\/wp-content\/uploads\/2017\/07\/veeam01-768x271.jpg 768w\" sizes=\"auto, (max-width: 786px) 100vw, 786px\" \/><\/p>\n<p>Aktion = Programm starten<\/p>\n<p>Programm =\u00a0C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe<\/p>\n<p>Argumente =\u00a0-noninteractive -nologo C:\\Scripts\\VeeamBackupDaily.ps1<\/p>\n<p>Was ich noch nicht implementiert habe, ist die automatische retention der Sicherungen. Theoretisch sollte das Veeam automatisch k\u00f6nnen. Allerdings funktionierte dies nicht auf Anhieb.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ich sichere meinen Labor-Exchange-Server seit neustem mit\u00a0Veeam Backup and Replication 9.5 Free, \u00fcber ein PowerShell Script (von hier). Ich habe&#8230; <a class=\"read-more\" href=\"https:\/\/itblog.wildi.dk\/?p=312\">Read more<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,10,13,41,42],"tags":[],"class_list":["post-312","post","type-post","status-publish","format-standard","hentry","category-allgemein","category-backup","category-exchange","category-veeam","category-windows"],"_links":{"self":[{"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=\/wp\/v2\/posts\/312","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=312"}],"version-history":[{"count":0,"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=\/wp\/v2\/posts\/312\/revisions"}],"wp:attachment":[{"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=312"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=312"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itblog.wildi.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=312"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}