DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Creating A Share On Windows

09.16.2005
| 2712 views |
  • submit to reddit
        Copied from John Nielson's <a href=http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/303341>recipe</a>.
import win32net
import win32netcon

shinfo={}

shinfo['netname']='python test'
shinfo['type']=win32netcon.STYPE_DISKTREE
shinfo['remark']='data files'
shinfo['permissions']=0
shinfo['max_uses']=-1
shinfo['current_uses']=0
shinfo['path']='c:\\my_data'
shinfo['passwd']=''
server='servername'

win32net.NetShareAdd(server,2,shinfo)