I'm not looking for syntax errors. I'm looking for reasons why it works with Windows servers but not samba servers. The short answer will probably be that samba servers aren't windows servers.
Sure
# ------------------------------------------------------------------
# function to pull windows logs and copy to remote server
# ------------------------------------------------------------------
function WriteLogs()
{
# Get logs from windows
$successlog = get-wbjob -previous 1 | select -ExpandProperty SuccessLogPath
$failurelog = get-wbjob -previous 1 | select -ExpandProperty FailureLogPath
$failuredesc = get-wbjob -previous 1 | select -ExpandProperty ErrorDescription
# write/format success log
$successfile = Get-Content $successlog
if(!(Test-Path -Path $slogpath))
{
New-Item -ItemType file $slogpath
}
Add-Content -Path $slogpath "HOST: $env:computername"
Add-Content -Path $slogpath "DATE: $date"
Add-Content -Path $slogpath "VOLUMES: $successfile".TrimEnd()
Add-Content -Path $slogpath "--------"
# write/format failure log
$failurefile = Get-Content $failurelog
if(!(Test-Path -Path $flogpath))
{
New-Item -ItemType file $flogpath
}
Add-Content -Path $flogpath "HOST: $env:computername"
Add-Content -Path $flogpath "DATE: $date"
Add-Content -Path $flogpath "FAILURES: $failurefile".TrimEnd()
Add-Content -Path $flogpath "DESCRIPTION: $failuredesc"
Add-Content -Path $flogpath "--------"
}
# ------------------------------------------------------------------
# Main
# ------------------------------------------------------------------
# Execute rotation if enabled
if ($MaxBackup -ne 0)
{
# Write-Host "Rotating Backups"
Rotation
}
# Backup folder creation
New-Item ($HomeBkpDir+"\"+$Filename) -Type Directory | Out-Null
$WBPolicy = New-WBPolicy
# Enable BareMetal functionnality (system state included)
Add-WBBareMetalRecovery -Policy $WBPolicy | Out-Null
# Add backup target
$BackupLocation = New-WBBackupTarget -network ($HomeBkpDir+"\"+$Filename)
Add-WBBackupTarget -Policy $WBPolicy -Target $BackupLocation -force | Out-Null
# Add non critical volumes
if ($Volumes -ne $null)
{
Add-WBVolume -Policy $WBPolicy -Volume $Volumes | Out-null
}
# Make this a full VSS backup as opposed to a copy backup. This will truncate Exchange logs etc...
Set-WBVssBackupOptions -policy $WBPolicy -vssfullbackup | Out-null
# Displays the backup settings prior to running the job.
$WBPolicy
# Runs the backup task.
Start-WBBackup -Policy $WBPolicy
# Write-Host "Writing Logs"
WriteLogs