Windows login script to automatically map users to Samba share

If you have configured Samba to share a folder and want your Windows users to automatically connect to it do the following:

Create a logon script logon.bat:

net use Z: /delete
net use Z: \\192.168.0.100\data

In a non-domain environment

Put this script in: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup on Windows 7 computers.
Put this script in: C:\Documents and Settings\All Users\Start Menu\Programs\Startup on Windows XP computers.

In a Windows domain environment

In a Windows domain environment you can can configure Group Policy to automatically run the logon script, or put it in:

Active Directory Users and Computers->Your User->Profle->Logon Script.

Windows Profile tab

Windows Profile tab