Using a mapped drive for backup in SQL server

Using a mapped drive for backup in SQL server

SQL server has always had this little peculiarity. The available drives for import/export of data or backup is limited to the physical drives of the computer. Any mapped drives are not visible.

The drives before the mapping:

…and the mapping

…and the drives after the mapping on the computer

…and the drives in the SQL server after the mapping

The reason for this is that the SQL server is mostly running as a different user than the one you used to logon to the system. However, it is possible to trick the SQL server into seeing a mapped drive.

The demonstration here is performed in Windows Server 2008 R2 but the principle is the same in Windows 7 or Windows 8. The inspiration for this workaround comes from the backup system CrashPlan who has a similar workaround for backing up to a NAS device.

In order to make a mapping visible to the SQL server, you first need to find out, which user account the SQL server is logged on. So start by going to services:

Normally the SQL server would be running a domain user, but in this case, it is the Local System account.

Now we need to make a logon script, and place somewhere on the disk accessible to the Local System account. Here I choose the c:\temp folder and create a new file called MapNetworkDrive.cmd. In the file, I write:

Now we need to run this script as the Local System account every time the system is restarted.

The Task Scheduler can help us there:

Creating the new task as the SYSTEM account and with highest priorities:

Setting the triggers:

And the Actions:

Now it ready to test:

Now the mapping of the computer will look the same, but if you disconnect the drive, we just mapped a while ago, the mapping will look like this:

…but from SQL server it suddenly looks like this:

Problem solved.

29 thoughts on “Using a mapped drive for backup in SQL server

  1. I just like the helpful information you supply for your articles. I will bookmark your weblog and test once more right here frequently. I am somewhat sure I will be informed many new stuff right here! Best of luck for the following!

  2. Yo, anyone tried 88online66? I’ve been browsing around and their site looks pretty slick. Thinking of throwing a few bucks their way. If you give it a whirl let me know your thoughts! Find out more: 88online66.

  3. I’ve been exploring for a little for any high quality articles or blog posts on this sort of area . Exploring in Yahoo I at last stumbled upon this website. Reading this info So i’m happy to convey that I’ve an incredibly good uncanny feeling I discovered just what I needed. I most certainly will make certain to don’t forget this website and give it a glance on a constant basis.

  4. Good day! I know this is kinda off topic but I was wondering if you knew where I could find a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having trouble finding one? Thanks a lot!

  5. 69vn15bet… alright, alright. The name is…interesting. Hoping the site is just as interesting in a *good* way. Time to dive in and see if the games are any fun. Fingers crossed! Vamanos! Check it out here: 69vn15bet

  6. Thanks for your entire effort on this web page. My niece take interest in carrying out investigation and it’s easy to see why. We learn all about the lively mode you deliver vital secrets on the blog and recommend response from other ones about this concern and our favorite child has been studying a great deal. Take advantage of the rest of the new year. You are always performing a terrific job.

  7. the best adult generator photo to video ai create erotic videos, images, and virtual characters. flexible settings, high quality, instant results, and easy operation right in your browser. the best features for porn generation.

  8. Virtually all of what you claim happens to be astonishingly accurate and that makes me wonder the reason why I hadn’t looked at this in this light before. This particular article really did switch the light on for me as far as this particular subject goes. However at this time there is actually one particular issue I am not really too comfortable with and whilst I attempt to reconcile that with the actual central idea of your issue, let me see just what all the rest of your visitors have to point out.Nicely done.

  9. Heya i’m for the primary time here. I found this board and I to find It truly helpful & it helped me out a lot. I hope to provide one thing back and help others such as you helped me.

  10. you are really a good webmaster. The site loading speed is amazing. It seems that you’re doing any unique trick. Furthermore, The contents are masterwork. you have done a fantastic job on this topic!

  11. Нужен проектор? projector24.ru/ большой выбор моделей для дома, офиса и бизнеса. Проекторы для кино, презентаций и обучения, официальная гарантия, консультации специалистов, гарантия качества и удобные условия покупки.

Leave a Reply

Your email address will not be published. Required fields are marked *