Web Analytics Made Easy -
StatCounter

Node Dangles

Accessing Network Drives via Scheduled Python Task

As previously mentioned, I have a scheduled nightly backup that is written in Python.  Most of it has been working fine but I had not gotten it to copy files to network drives.  I finally got around to correcting that part.  My first attempt was just to map the network drives for the user account that is used to run the task.  No good.

My second attempt was to call a .bat file from python before accessing the network drives and that worked.

The batch file has two lines (one for each network drive):

net use n: \domain1sharename mypassword /USER:domainusername
net use t: \domain2sharename mypassword /USER:domainusername

And my python script includes two lines to call it before I access the network locations:

import os
os.system('C:/cwi5_bk/mapDrive.bat')
Menu