PowerShell script exchange
Post Reply
max1985max
Novice
Posts: 7
Liked: never
Joined: Apr 08, 2021 2:14 pm
Full Name: M.A.
Contact:

Powershell script and warning

Post by max1985max »

Hi @ all,

we have the Powershell Script running (# Author: Vladimir Eremin, # Created Date: 3/24/2015) I think you all know it and it makes no errors, it seems to work. But we had a WARNING at the free VEEAM Edition:

Warning: "Skipping credentials backup because the encryption is disabled. This will complicate the restore process significantly. Enable configuration backup encryption to stop receiving this warning."

Can anybody explain what this message stand for? Everything seems to work - no issues - so why there is an warning?

Many thanks
Max

oleg.feoktistov
Veeam Software
Posts: 847
Liked: 300 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Powershell script and warning

Post by oleg.feoktistov »

Hi,

I know Vladimir, but I'm not familiar with the script. Can you, please, maybe share the link? I'll check it.

Thanks,
Oleg

mzollmann
Veeam Software
Posts: 33
Liked: 15 times
Joined: Mar 01, 2017 2:10 pm
Full Name: Mike Zollmann
Contact:

Re: Powershell script and warning

Post by mzollmann »

The warning is telling you that your Veeam configuration Backups is not set for encryption. Which means all credentials in the Credential Manager will not be included in the Config backup. If you had to restore the Config backup you would need to re-enter all credentials.

So this warning is telling you to simplify restore of Config backups, enable the encryption on them so that Credentials will be included and protected in the Config backup.
Mike Zollmann
Sr. Systems Engineer - VCSP

max1985max
Novice
Posts: 7
Liked: never
Joined: Apr 08, 2021 2:14 pm
Full Name: M.A.
Contact:

Re: Powershell script and warning

Post by max1985max »

Code: Select all

# Author: Vladimir Eremin
# Created Date: 3/24/2015

##################################################################
#                   User Defined Variables
##################################################################

# Names of VMs to backup separated by comma (Mandatory). For instance, $VMNames = “VM1”,”VM2”
$VMNames = "srv1","srv2"

# Name of vCenter or standalone host VMs to backup reside on (Mandatory)
$HostName = "srvhyperv01"

# Directory that VM backups should go to (Mandatory; for instance, C:\Backup)
$Directory = "D:\HyperVBackup"

# 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 = "In1Week"

##################################################################
#                   Notification Settings
##################################################################

# Enable notification (Optional)
$EnableNotification = $True

# Email SMTP server
$SMTPServer = "XXX.XXX.XXX"

# Email FROM
$EmailFrom = "XXX@XXX.XXX" 

# Email TO
$EmailTo = "XXX@XXX.XXX"

# Email subject
$EmailSubject = "[Success] Backup VEEAM ZIP srvhypervbu01"

##################################################################
#                   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)
}


max1985max
Novice
Posts: 7
Liked: never
Joined: Apr 08, 2021 2:14 pm
Full Name: M.A.
Contact:

Re: Powershell script and warning

Post by max1985max »

mzollmann wrote: Apr 08, 2021 2:27 pm The warning is telling you that your Veeam configuration Backups is not set for encryption. Which means all credentials in the Credential Manager will not be included in the Config backup. If you had to restore the Config backup you would need to re-enter all credentials.

So this warning is telling you to simplify restore of Config backups, enable the encryption on them so that Credentials will be included and protected in the Config backup.
So if I know the Windows Login and the Veeam Login, its no problem right?

mzollmann
Veeam Software
Posts: 33
Liked: 15 times
Joined: Mar 01, 2017 2:10 pm
Full Name: Mike Zollmann
Contact:

Re: Powershell script and warning

Post by mzollmann »

The credentials are the ones you use for Backup Jobs/Backup copy jobs, App aware, etc. These are stored in the Veeam Credential Manager.

This is a warning, it does not stop the Config backup, just means those credentials will not be a part of the backup. It will store the config backups and you can restore from them, but will not include credentials (which can make restoring full config challenging as you will need to input all credentials used for Jobs/app aware, etc. for Jobs to work)
Mike Zollmann
Sr. Systems Engineer - VCSP

max1985max
Novice
Posts: 7
Liked: never
Joined: Apr 08, 2021 2:14 pm
Full Name: M.A.
Contact:

Re: Powershell script and warning

Post by max1985max »

ok Thank you all!

veremin
Product Manager
Posts: 18333
Liked: 1799 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Powershell script and warning

Post by veremin » 1 person likes this post

And to stop getting it, you need to do exactly what warning says - enable encryption in configuration backup settings. Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests