When running a osql query to backup a database to disk to "Cannot open backup device" error may be seen:
osql -S server\instance -E -Q "BACKUP DATABASE database TO DISK = '\\server\share\database.bak'"
Msg 3201, Level 16, State 1, Server server\instance, Line 1
Cannot open backup device '\\server\share\database.bak'. Operating system error 5(error not found).
Msg 3013, Level 16, State 1, Server server\instance, Line 1
BACKUP DATABASE is terminating abnormally.
The alternative error may be seen:
Msg 3201, Level 16, State 1, Server server\instance, Line 1
Cannot open backup device '\\server\share\database.bak'. Device error or device off-line. See the SQL Server error log for more details.
Msg 3013, Level 16, State 1, Server server\instance, Line 1
BACKUP DATABASE is terminating abnormally.