-
- Influencer
- Posts: 10
- Liked: 1 time
- Joined: Aug 03, 2018 1:12 pm
- Contact:
Powershell VeeamZip
Hi all. Apologies if this has been covered, I did do some searches.
We just upgraded from 9.5 to 11. It went well.
Everything is working well, but I have a special monthly Veeamzip job using a scheduled Powershell job that no longer works.
Is there still support for Powershell scripted Veeamzip in version 11?
Thanks.
We just upgraded from 9.5 to 11. It went well.
Everything is working well, but I have a special monthly Veeamzip job using a scheduled Powershell job that no longer works.
Is there still support for Powershell scripted Veeamzip in version 11?
Thanks.
-
- Veeam Software
- Posts: 2011
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: Powershell VeeamZip
Hi,
Yes, VeeamZIP cmdlet is supported in v11. Can you please post your script and the error if any? I will have a look.
Thanks,
Oleg
Yes, VeeamZIP cmdlet is supported in v11. Can you please post your script and the error if any? I will have a look.
Thanks,
Oleg
-
- Influencer
- Posts: 10
- Liked: 1 time
- Joined: Aug 03, 2018 1:12 pm
- Contact:
Re: Powershell VeeamZip
Thanks for the reply!
The script is pretty much a copy/pasta from the standard one in the forums back in 2015.
Looking at it again today with fresh eyes/brain it appears that I'm just missing the PowerShell snapin.
I re-ran the install, still missing. I'm assuming that it's supposed to be installed by default.
The error message is:
Asnp : The Windows PowerShell snap-in 'VeeamPSSnapin' is not installed on this computer.
At C:\backup\sample.ps1:73 char:1
The script is pretty much a copy/pasta from the standard one in the forums back in 2015.
Looking at it again today with fresh eyes/brain it appears that I'm just missing the PowerShell snapin.
I re-ran the install, still missing. I'm assuming that it's supposed to be installed by default.
The error message is:
Asnp : The Windows PowerShell snap-in 'VeeamPSSnapin' is not installed on this computer.
At C:\backup\sample.ps1:73 char:1
Code: Select all
# Author: Vladimir Eremin
# Created Date: 3/24/2015
# http://forums.veeam.com/member31097.html
#
##################################################################
# User Defined Variables
##################################################################
# Names of VMs to backup separated by comma (Mandatory). For instance, $VMNames = “VM1”,”VM2”
$VMNames = "RDS-1"
# Name of vCenter or standalone host VMs to backup reside on (Mandatory)
$HostName = "Hyper-v-2"
# Directory that VM backups should go to (Mandatory; for instance, C:\Backup)
$Directory = "F:\Veeam"
# Desired compression level (Optional; Possible values: 0 - None, 4 - Dedupe-friendly, 5 - Optimal, 6 - High, 9 - Extreme)
$CompressionLevel = "5"
# Quiesce VM when taking snapshot (Optional; VMware Tools are required; Possible values: $True/$False)
$EnableQuiescence = $False
# Protect resulting backup with encryption key (Optional; $True/$False)
$EnableEncryption = $False
# Encryption Key (Optional; path to a secure string)
$EncryptionKey = ""
# Retention settings (Optional; By default, VeeamZIP files are not removed and kept in the specified location for an indefinite period of time.
# Possible values: Never , Tonight, TomorrowNight, In3days, In1Week, In2Weeks, In1Month)
$Retention = "Never"
##################################################################
# Notification Settings
##################################################################
# Enable notification (Optional)
$EnableNotification = $True
# Email SMTP server
$SMTPServer = "mail.mydomain.ca"
# Email FROM
$EmailFrom = "info@mydomain.ca"
# Email TO
$EmailTo = "me@mydomain.ca"
# Email subject
$EmailSubject = "Veeam Scheduled Backup - Hyper-V-2"
##################################################################
# Email formatting
##################################################################
$style = "<style>BODY{font-family: Arial; font-size: 10pt;}"
$style = $style + "TABLE{border: 1px solid black; border-collapse: collapse;}"
$style = $style + "TH{border: 1px solid black; background: #dddddd; padding: 5px; }"
$style = $style + "TD{border: 1px solid black; padding: 5px; }"
$style = $style + "</style>"
##################################################################
# End User Defined Variables
##################################################################
#################### DO NOT MODIFY PAST THIS LINE ################
Asnp VeeamPSSnapin
$Server = Get-VBRServer -name $HostName
$MesssagyBody = @()
foreach ($VMName in $VMNames)
{
$VM = Find-VBRHvEntity -Name $VMName -Server $Server
If ($EnableEncryption)
{
$EncryptionKey = Add-VBREncryptionKey -Password (cat $EncryptionKey | ConvertTo-SecureString)
$ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention -EncryptionKey $EncryptionKey
}
Else
{
$ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $CompressionLevel -DisableQuiesce:(!$EnableQuiescence) -AutoDelete $Retention
}
If ($EnableNotification)
{
$TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
$FailedSessions = $TaskSessions | where {$_.status -eq "EWarning" -or $_.Status -eq "EFailed"}
if ($FailedSessions -ne $Null)
{
$MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object @{n="Name";e={($_.name).Substring(0, $_.name.LastIndexOf("("))}} ,@{n="Start Time";e={$_.CreationTime}},@{n="End Time";e={$_.EndTime}},Result,@{n="Details";e={$FailedSessions.Title}})
}
Else
{
$MesssagyBody = $MesssagyBody + ($ZIPSession | Select-Object @{n="Name";e={($_.name).Substring(0, $_.name.LastIndexOf("("))}} ,@{n="Start Time";e={$_.CreationTime}},@{n="End Time";e={$_.EndTime}},Result,@{n="Details";e={($TaskSessions | sort creationtime -Descending | select -first 1).Title}})
}
}
}
If ($EnableNotification)
{
$Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
$Message.Subject = $EmailSubject
$Message.IsBodyHTML = $True
$message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
$SMTP = New-Object Net.Mail.SmtpClient($SMTPServer)
$SMTP.Send($Message)
}
-
- Veeam Software
- Posts: 2011
- Liked: 670 times
- Joined: Sep 25, 2019 10:32 am
- Full Name: Oleg Feoktistov
- Contact:
Re: Powershell VeeamZip
In v11 we migrated our PS snap-in to module since starting from v6 Powershell doesn't support snap-ins.
The module should be already there upon VBR console installation. So, feel free to remove the line, which imports snap-in.
If you experience any issues with the module, please, let me know. Thanks!
The module should be already there upon VBR console installation. So, feel free to remove the line, which imports snap-in.
If you experience any issues with the module, please, let me know. Thanks!
-
- Influencer
- Posts: 10
- Liked: 1 time
- Joined: Aug 03, 2018 1:12 pm
- Contact:
Re: Powershell VeeamZip
Great, thanks!
Turns out my $hostnames now need fqdn where before they didn't. All good now.
Thanks again!
Turns out my $hostnames now need fqdn where before they didn't. All good now.
Thanks again!
Who is online
Users browsing this forum: No registered users and 5 guests