Hello,
I have a PowerShell script for performing backups;
write-eventlog -LogName Application -source WSH -entrytype Information -message "Backup - BEGIN" -eventid 1
Import-Module "sqlps"
Backup-SqlDatabase -ServerInstance . -Database "[database]" -BackupFile "C:\BACKUPS\DB.BAK" -Initialize -CopyOnly
write-eventlog -LogName Application -source WSH -entrytype Information -message "Backup - END" -eventid 1
This works fine for an interactively-logged on administrator.
When I run the same script as a scheduled task for a more limited user, it fails, with
Date 07/10/2015 20:46:26
Log SQL Server (Current - 07/10/2015 20:46:00)
Source Backup
Message
BACKUP failed to complete the command BACKUP DATABASE [database]. Check the backup application log for detailed messages.
Go to the complete details ...