Restoring to a network paths?

I'm getting the error "The file \\xxx... is on a network path that is not supported for database files. File xx cannot be restored to \\xx..... Use WITH MOVE to identify a valid location for the file. Below is my code for the restore. I've even shared the folder on the network but still no success.

Try
Dim restoreToServer As New Server("xxxx")
Dim rest As New Restore
rest.Devices.AddDevice("\\xx\x$\Program Files\Microsoft SQL Server\MSSQL\BACKUP\myData\myData.BAK", DeviceType.File)

rest.Action = RestoreActionType.Database
rest.Database = "myDatabase"
rest.NoRecovery = False
rest.ReplaceDatabase = True

rest.RelocateFiles.Add(New RelocateFile("myData", "\\xx\data\myData.mdf"))
rest.RelocateFiles.Add(New RelocateFile("myData_log", "\\xx\logs\myData.ldf"))

rest.SqlRestore(restoreToServer)
Catch ex As Exception
MessageBox.Show(ex.InnerException.ToString)

End Try



Answer this question

Restoring to a network paths?