Pages

Map network share via script

 To map network share via batch script I am using this simple script


@echo off
net use DRIVE_LETTER: /delete /yes
net use DRIVE_LETTER: \\network_server\share /user:DOMAIN_NAME\%USERNAME% /persistent /yes


Where:

DRIVER_LETTER - the letter under which would be the network share mapped, i.e. W:

network_server - it could be IP address or local server name (if DNS is properly setup), i.e. server.example.local

share - name of the network share that we want to map, i.e. documents

DOMAIN_NAME - your local domain name (Active Direcotory or Linux Samba AD), i.e EXAMPLE

%USERNAME% - used in a script gets current username, i.e jdoe