Python Authentication to SAMBA share
<p>I'm able to map the drive without problems on network shares without authentication. But I'm missing something once I try to authenticate with a username and password. Here is the current working example of the code with the error message I keep receiving.</p>

<pre><code>#!/usr/bin/python
# Drive Map Script
import pywintypes
import win32com.client

# Disconnect previous mapped drives
testnetwork = win32com.client.Dispatch('Wscript.Network')
network_drives = testnetwork.EnumNetworkDrives()
for mapped_drive in [network_drives.Item(i)
                     for i in range(0, network_drives.Count() -1 , 2)
                     if network_drives.Item(i)]:
    testnetwork.RemoveNetworkDrive(mapped_drive, True, True)

# Mount the drives
drive_mapping = [
    ('z:', '\\\\192.168.1.100\\Some_Share', 'someuser', 'somepass')]

for drive_letter, network_path, user_name, user_pass in drive_mapping:
    try:
        testnetwork.MapNetworkDrive(drive_letter, network_path)
    except Exception, err:
        print err
</code></pre>

<p>And the error the code generates upon execution:</p>

<blockquote>
  <p>(-2147352567, 'Exception occurred.',
  (0, u'WSHNetwork.MapNetworkDrive',
  u'Logon failure: unknown user name or
  bad password.\r\n', None, 0,
  -2147023570), None)</p>
</blockquote>
