[python-win32] Created Map NetWork Drive is not visible in "My Computer" window

Mike Driscoll mdriscoll at co.marshall.ia.us
Mon Aug 25 16:39:04 CEST 2008


siddhartha veedaluru wrote:
> That worked.
>  
> Thanks very much Mike
>  
> Sid


One thing I forgot to mention. You might want to check if that drive is 
already mapped or you'll get an error. We force our drive letters by 
using the WNetCancelConnection2() method of win32wnet to un-map the 
drive letter if it's already mapped before we map the drives. We do this 
because some of users stick USB drives or other devices into their PCs 
before they login and the USB drive will grab the drive letter.

Mike



>
> On Mon, Aug 25, 2008 at 7:31 PM, Mike Driscoll 
> <mdriscoll at co.marshall.ia.us <mailto:mdriscoll at co.marshall.ia.us>> wrote:
>
>     siddhartha veedaluru wrote:
>
>         Hi,
>          i have used the following code to create Map NetWork Drive.
>         But it is not visble when i open "My Computer" window.
>          ---------------------------------------------------------------------------
>         import win32net,time
>         data = {}
>         data['remote'] = r'\\fredo\Project'
>         data['local'] = 'K:'
>         data['user'] = 'builder'
>         data['password'] = 'builder'
>         data['asg_type'] = 0
>         data['status'] = 1
>         data['domainname'] = 'conindia'
>         win32net.NetUseAdd(None,1,data)
>         -----------------------------------------------------------------------
>          Help me in making it visible.
>          Regards,
>         Siddhartha
>
>
>     I recommend this method instead:
>
>     <code>
>     import win32wnet
>     from win32netcon import RESOURCETYPE_DISK as DISK
>
>     drive_letter = "K:"
>     path = "\\fredo\Project"
>     win32wnet.WNetAddConnection2(DISK, drive_letter, path)
>
>     </code>
>
>     We use this method at my place of employment as part of our login
>     script.
>
>     Mike
>
>



More information about the python-win32 mailing list