title: How to programatically add mapped network passwords (WinXP)?
body: <p>In WinXP (SP2) you can store mapped network passwords...</p>
  
  <p>Start->Control Panel->User Accounts->Pick one then choose "Manage my network passwords" from Related Tasks.</p>
  
  <p>I normally have about 25-30 servers mapped this way to a few different accounts/domains.  The problem is that at some point during our policy updates they get wiped out and it's a real PITA to add them all back again.</p>
  
  <p>Does anyone know how to add them programatically using some sort of script?</p>
  
  <p>Just to clarify, the end goal is not to map drives, it's to actually create the entries in that section.  This allows us to use Windows authentication for connecting to our servers (via Dameware, SSMS etc.).</p>
  
  <p><strong>Addendum:</strong></p>
  
  <p>Mark's CredWrite tip led me here...</p>
  
  <p><a href="http://www.pinvoke.net/default.aspx/advapi32/CredWrite.html" rel="nofollow noreferrer">pinvoke.net -- CredWrite (advapi32)</a></p>
  
  <p>Which in turn led me here...</p>
  
  <p><a href="http://blogs.msdn.com/peerchan/pages/487834.aspx" rel="nofollow noreferrer">Peer Channel Blog -- Application Password Security</a></p>
  
  <p>Both have proved very helpful.</p>