Veeam Backup Free,Samba共享和PowerShell:拒绝访问
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Veeam Backup Free,Samba共享和PowerShell:拒绝访问相关的知识,希望对你有一定的参考价值。
我有:
- ESXi主机包含一些虚拟机
- Veeam Backup免费版安装在其中一台虚拟机上(Windows Server 2012 R2)
- Debian主机上有samba
我成功了:
- 在debian机器上使用samba创建共享文件夹
- 使用Veeam Backup GUI手动备份到debian机器上的文件夹
我遇到麻烦:
- 从PowerShell脚本运行备份以便能够进行计划备份。
这篇关于Veeam论坛的topic建议
授予Veeam帐户以及给定共享的计算机帐户读/写权限
但我不知道如何将这些权限实际授予samba文件夹。
能否帮助我授予samba文件夹权限?
这是脚本:
# Author: Vladimir Eremin
# Created Date: 3/24/2015
# http://forums.veeam.com/member31097.html
#
##################################################################
# User Defined Variables
##################################################################
# Names of VMs to backup separated by semicolon (Mandatory)
$VMNames = "<my vm name>"
# Name of vCenter or standalone host VMs to backup reside on (Mandatory)
$HostName = "<my hostname>"
# Directory that VM backups should go to (Mandatory; for instance, C:Backup)
$Directory = "\1.2.3.4ackup"
# 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 = $False
# Email SMTP server
$SMTPServer = ""
# Email FROM
$EmailFrom = ""
# Email TO
$EmailTo = ""
# Email subject
$EmailSubject = ""
##################################################################
# 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-VBRViEntity -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 Data Mover”服务设置为具有写入目标权限的帐户。
以上是关于Veeam Backup Free,Samba共享和PowerShell:拒绝访问的主要内容,如果未能解决你的问题,请参考以下文章
Veeam Backup Configuration Tool