I am trying to restore a backup via command line as part of a Windows scheduled task. The restore runs successfully from a PowerShell console, but fails when run as a scheduled task using the same user. If I add the user to the Administrators group, the task succeeds, but I would like to grant only the necessary privileges.
The LiteSpeed error message:
LiteSpeedr for SQL Serverr could not create the virtual backup device for the database.
SQLVDI generates the following event in the event log:
SQLVDI: Loc=IdentifySQLServer. Desc=MSSQLSERVER. ErrorCode=(5)Access is denied.
. Process=4900. Thread=972. Client. Instance=. VD=.
The scheduled task is set to run with highest privileges and the user has been granted privileges to create global objects in secpol.msc. The user is part of the sysadmin role on the SQL Server.
What additional privileges do I need to grant the Windows user for the scheduled task to work?