i tried to create a Script that should do the following in a SureBackup Job.
1. Open a File on a Windows Share of the loaded VM
2. Check the Content of the File
3. exit 0 or 1 depending on the content
If i start the VM in SureBackup and execute the Script manually on the VBR Server (VBR 12.1) the Script is working fine. If i use the same Script inside the SureBackup Job it failes.
Here is the Script i use:
Code: Select all
$networkPath = "\\10.255.150.113\Monitoring\veeam.txt"
$networkUsername = "yyyyyyy"
$networkPassword = ConvertTo-SecureString "xxxxxx" -AsPlainText -Force
$networkCredential = New-Object -TypeName PSCredential -ArgumentList $networkUsername, $networkPassword
$result = Invoke-Command -ScriptBlock {
param($filePath, $credentials)
$content = Get-Content $filePath
$content -contains "OK"
} -ArgumentList $networkPath, $networkCredential
if ($result) {
Write-Host "Datei enthält 'OK'. Rückgabewert: 0"
exit 0
} else {
Write-Host "Datei enthält kein 'OK'. Rückgabewert: 1"
exit 1
}
10.255.150.113 is the IP of the VM inside SureBackup. As mentioned, exactly that Script works fine when started manually against the running VM in SureBackup.
Inside of SureBackup i get the following error in the Veeam Logs:
Code: Select all
[Console] + $content = Get-Content $filePath
[Console] + ~~~~~~~~~~~~~~~~~~~~~
[Console] + CategoryInfo : PermissionDenied: (\\10.255.150.113\Monitoring\veeam.txt:String) [Get-Content], UnauthorizedAccessException
+ FullyQualifiedErrorId : ItemExistsUnauthorizedAccessError,Microsoft.PowerShell.Commands.GetContentCommand
[...]
Maybe someone here is able to help.
Thank you and best regards
Sebastian