Running a backup script on Sql 2014 to a UNC path fails with error

Running a backup script on Sql 2014 to a UNC path fails with error (operating system error code 3(the system cannot find the path specified). We have tried to give full rights to the folder but nothing seems to be working. The backup job does works fine if we send it to the C:\ drive. Is there anything else we can try?

Script i'm running:
--- Automatically do Full Backup of all databases simple Recovery Mode

DECLARE @name VARCHAR(50) -- database name  
DECLARE @path VARCHAR(256) -- path for backup files  
DECLARE @fileName VARCHAR(256) -- filename for backup  
DECLARE @fileDate VARCHAR(20) -- used for file name 

SET @path = '\\server-4\c$\BackupLocation\'  --Case Sensitive

SELECT @fileDate = CONVERT(VARCHAR(20),GETDAT<wbr ></wbr>E(),112) 
   + '_' 
   + REPLACE(CONVERT(VARCHAR(20<wbr ></wbr>),GETDATE(<wbr ></wbr>),108),':'<wbr ></wbr>,'')

FROM master.dbo.sysdatabases 
    name NOT IN (N'tempdb') AND

OPEN db_cursor   
FETCH NEXT FROM db_cursor INTO @name 

       SET @fileName = @path + @name + '_Full_' + @fileDate + '.bak'  
       PRINT 'Backup Database command being issued on database "' + @name + '".' 
       BACKUP database @name TO DISK = @fileName WITH CONTINUE_AFTER_ERROR 
       --IF @@ERROR > 0
           --add code here to record and/or notify yourself that an error occurred during BACKUP
       --END --IF
       FETCH NEXT FROM db_cursor INTO @name   

CLOSE db_cursor   
DEALLOCATE db_cursor 

--Simple: No log backups. Automatically reclaims log space to keep space requirements small, essentially eliminating the need to manage the transaction log space. 
--Full: Requires log backups. No work is lost due to a lost or damaged data file. Can recover to an arbitrary point in time (for example, prior to application or user error). 

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vitor MontalvãoMSSQL Senior EngineerCommented:
Who's the user that is running the script? It need to have access in the share.
CityInfoSysAuthor Commented:
It is the sa account.
Vitor MontalvãoMSSQL Senior EngineerCommented:
SA account it's a SQL login and not a Windows login. You can't give permissions on a share to SA, right?
The SQL Server account or SQL Agent account are domain accounts?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

CityInfoSysAuthor Commented:
Under services they are both the default log on as (NT AUTHORITY\System). But no they are not domain accounts. Could I just change the log on as to a local user?
Vitor MontalvãoMSSQL Senior EngineerCommented:
I wrote an article explaining why NT AUTHORITY\System shouldn't be used as service account. Please take a read on it so you can understand it better.
Local users can't access to the network since they exists only on local computers. You may change the SQL Server and Agent accounts to NT AUTHORITY\Network Service. Still not good but better that System.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
CityInfoSysAuthor Commented:
If i change the NT AUTHORITY\System on the SQL agent service will it cause any issues (besides affecting backups) while the server is running?
CityInfoSysAuthor Commented:
I was wrong the sql server agent log on as is NT Service\SQLSERVERAGENT.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.