-
- Enthusiast
- Posts: 27
- Liked: never
- Joined: Feb 16, 2016 7:51 pm
- Full Name: Jan Meinecke
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Thx for trying and i am happy that it worked for you...so it can be only my environment...will try your changes if there are any...
Thx...and i will check the powershell version as well...
Thx...and i will check the powershell version as well...
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
I mentioned PS version deliberately, because up to that moment I've seen various strange issues related to usage of PowerShell 2.0, such as missing properties, unavailable methods, obscure errors, etc.
Thus, I always recommend using PowerShell 4.0 at least.
Thanks.
Thus, I always recommend using PowerShell 4.0 at least.
Thanks.
-
- Enthusiast
- Posts: 27
- Liked: never
- Joined: Feb 16, 2016 7:51 pm
- Full Name: Jan Meinecke
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Hmmm..just checked...i have version 4.0
-
- Enthusiast
- Posts: 27
- Liked: never
- Joined: Feb 16, 2016 7:51 pm
- Full Name: Jan Meinecke
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Wow...a lot of changes...very interesting
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
I just commented everything not applying either to my infrastructure (usage of PowerCLI) or to my test (sending email), but it shouldn't have affected the result property value anyhow. Thanks.
-
- Enthusiast
- Posts: 27
- Liked: never
- Joined: Feb 16, 2016 7:51 pm
- Full Name: Jan Meinecke
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Something must be different to your system setup...
Your example does not stop baking up one and the same machine over and over again...
So very strange...and of course no result variable value
Your example does not stop baking up one and the same machine over and over again...
So very strange...and of course no result variable value
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
As I've illustrated, everything works in my environment, so, it's hard to tell what might be wrong with the script.
The simplest test would be to assign result of Start-VBRZIP commandlet to a variable and check whether it contains non nullable object. Something like:
Thanks.
The simplest test would be to assign result of Start-VBRZIP commandlet to a variable and check whether it contains non nullable object. Something like:
Code: Select all
$bk_result = Start-VBRZip -Entity (Find-VBRViEntity -Name "Name of your VM" -Server (Get-VBRServer -Name "Name of your host/VC")) -Folder "Name of destination folder"
$bk_result.result
-
- Lurker
- Posts: 1
- Liked: never
- Joined: Aug 25, 2016 2:52 pm
- Full Name: Stefano
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
I've been trying to implement the script to run scheduled backups of my Hyper-V VM with the Free Edition.
When I try to run it in PS, the backup process diaglog opens for a about 20 seconds:
Then it just closes without doing anything. No error code, nothing.
What could that be?
Stef
When I try to run it in PS, the backup process diaglog opens for a about 20 seconds:
Then it just closes without doing anything. No error code, nothing.
What could that be?
Stef
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Aug 26, 2016 2:32 am
- Full Name: Jeff-LGPC
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Hi All,
I'm trying to get this to work, but cant: https://www.veeam.com/blog/veeam-backup ... shell.html
I keep getting this, can anyone help?
I'm trying to get this to work, but cant: https://www.veeam.com/blog/veeam-backup ... shell.html
I keep getting this, can anyone help?
Code: Select all
Windows PowerShell
Copyright (C) 2014 Microsoft Corporation. All rights reserved.
PS H:\> C:\VeeamZIP.ps1
Get-VBRServer : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Veeam\Veeam Backup and Replication' is denied.
At C:\VeeamZIP.ps1:71 char:11
+ $Server = Get-VBRServer -name $HostName
+ ~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException
Find-VBRHvEntity : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Veeam\Veeam Backup and Replication' is
denied.
At C:\VeeamZIP.ps1:76 char:9
+ $VM = Find-VBRHvEntity -Name $VMName -Server $Server
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException
Start-VBRZip : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Veeam\Veeam Backup and Replication' is denied.
At C:\VeeamZIP.ps1:86 char:19
+ $ZIPSession = Start-VBRZip -Entity $VM -Folder $Directory -Compression $Comp ...
+ ~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException
You cannot call a method on a null-valued expression.
At C:\VeeamZIP.ps1:91 char:5
+ $TaskSessions = $ZIPSession.GetTaskSessions().logger.getlog().updatedrecords
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
New-Object : Exception calling ".ctor" with "2" argument(s): "The parameter 'from' cannot be an empty string.
Parameter name: from"
At C:\VeeamZIP.ps1:108 char:12
+ $Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
The property 'Subject' cannot be found on this object. Verify that the property exists and can be set.
At C:\VeeamZIP.ps1:109 char:1
+ $Message.Subject = $EmailSubject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property 'IsBodyHTML' cannot be found on this object. Verify that the property exists and can be set.
At C:\VeeamZIP.ps1:110 char:1
+ $Message.IsBodyHTML = $True
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property 'Body' cannot be found on this object. Verify that the property exists and can be set.
At C:\VeeamZIP.ps1:111 char:1
+ $message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
Exception calling "Send" with "1" argument(s): "Value cannot be null.
Parameter name: message"
At C:\VeeamZIP.ps1:113 char:1
+ $SMTP.Send($Message)
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullException
Jeff.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Have you tried to check the backup console? May be something is reported there?What could that be?
Run a script under Administrator account.I keep getting this, can anyone help?
Thanks.
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Aug 26, 2016 2:32 am
- Full Name: Jeff-LGPC
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
I tried running it from an admin account, still no good
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Are you positive you've run the script as Administrator (right-click - Run As Administrator)? Also, you can try to change the permissions of the following registry key:
Thanks.
Code: Select all
\\HKEY_LOCAL_MACHINE\SOFTWARE\Veeam\Veeam Backup and Replication\ -> Users full control
-
- Enthusiast
- Posts: 27
- Liked: never
- Joined: Feb 16, 2016 7:51 pm
- Full Name: Jan Meinecke
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Check if your setup does a regular backup from the free version GUI...looks to me, that there is either a backup target rights issue or some other part in the route not right...
So if the backup of you vm works with Veeam free gui and you are using the same targets and vm's...let us know
So if the backup of you vm works with Veeam free gui and you are using the same targets and vm's...let us know
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Aug 26, 2016 2:32 am
- Full Name: Jeff-LGPC
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
The registry key has the administrators group on the domain with full control, and I'm running this as me and I'm a domain admin.
I can run the backup from the GUI and it does write the file to the target with no problem.
I can run the backup from the GUI and it does write the file to the target with no problem.
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Aug 26, 2016 2:32 am
- Full Name: Jeff-LGPC
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
I changed the registry key to add domain admin with full control and it seemed to work, but now I get this:
Code: Select all
New-Object : Exception calling ".ctor" with "2" argument(s): "The parameter 'from' cannot be an empty string.
Parameter name: from"
At C:\VeeamZIP.ps1:108 char:12
+ $Message = New-Object System.Net.Mail.MailMessage $EmailFrom, $EmailTo
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
The property 'Subject' cannot be found on this object. Verify that the property exists and can be set.
At C:\VeeamZIP.ps1:109 char:1
+ $Message.Subject = $EmailSubject
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property 'IsBodyHTML' cannot be found on this object. Verify that the property exists and can be set.
At C:\VeeamZIP.ps1:110 char:1
+ $Message.IsBodyHTML = $True
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property 'Body' cannot be found on this object. Verify that the property exists and can be set.
At C:\VeeamZIP.ps1:111 char:1
+ $message.Body = $MesssagyBody | ConvertTo-Html -head $style | Out-String
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
Exception calling "Send" with "1" argument(s): "Value cannot be null.
Parameter name: message"
At C:\VeeamZIP.ps1:113 char:1
+ $SMTP.Send($Message)
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ArgumentNullException
JB
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
You appear to have provided empty strings as email notification settings (from, to). Either specify proper values or disable notification. Thanks.
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Aug 26, 2016 2:32 am
- Full Name: Jeff-LGPC
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
I edited all the email fields, but the email provider we use (MS Office365) will mostly want authentication and it doesnt have any fields for that.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Have you tried the approach recommended here? Thanks.
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Aug 26, 2016 2:32 am
- Full Name: Jeff-LGPC
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Hello All, I think adding permissions to that registry key solved my problem. Thank you!!
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
I understood that by tweaking the said regkey you were able to make script finally work, but I was actually answering your last question (how authenticate against O365 mailbox) and giving the links to how it can be done. Thanks.
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Aug 26, 2016 2:32 am
- Full Name: Jeff-LGPC
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
I couldn't get the email portion working, not sure if anyone else out there got it working, but I would like to know how.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Have you checked the link that I provided previously, it describes exactly that? Thanks.
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Aug 26, 2016 2:32 am
- Full Name: Jeff-LGPC
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
I didn't see that link, can you please post it again
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Aug 26, 2016 2:32 am
- Full Name: Jeff-LGPC
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
email still doesnt work
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Could you elaborate on that? What exactly error did you get? Have you adapted the example provided in the given article ("Sending Email from PowerShell via Office 365")? May be a snippet of your current script would be helpful. Thanks.
-
- Influencer
- Posts: 13
- Liked: never
- Joined: Aug 26, 2016 2:32 am
- Full Name: Jeff-LGPC
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
Hi, the job ran and the backup completed, but no email. This is what I have:
Code: Select all
##################################################################
# Notification Settings
##################################################################
# Enable notification (Optional)
$EnableNotification = $True
# Email SMTP server
$SMTPServer = 'smtp.office365.com'
$SmtpUser = 'jbadre@southhackensacknj.org'
$smtpPassword = ''P@ssw0rd1'
# Email TO
$MailTo = 'jeff@letsgetpersonalcomputing.com'
# Email FROM
$MailFrom = 'jbadre@southhackensacknj.org'
# Email subject
$MailSubject = "Test using $SmtpServer"
$Credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $SmtpUser, $($smtpPassword | ConvertTo-SecureString -AsPlainText -Force)
Send-MailMessage -To "$MailtTo" -from "$MailFrom" -Subject $MailSubject -SmtpServer $SmtpServer -UseSsl -Credential $Credentials
##################################################################
# 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)
}
-
- Enthusiast
- Posts: 27
- Liked: never
- Joined: Feb 16, 2016 7:51 pm
- Full Name: Jan Meinecke
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
How about setting a breakpoint at the mail sending event and see if all variables contain the values you think they should have...
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
It might be even worth splitting the script (since backup portion works well) and testing o365 email generation part separately. Thanks.
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Start-VBRZip in Veeam Backup Free Edition
I've split the discussion. Kindly, continue conversation regarding Office 365 notifications in this thread. Thanks.
Who is online
Users browsing this forum: No registered users and 6 guests