Network connections won't die


E

e.fabene

Hi all,
I'm having a problem mapping drives to network shares via scripts.
The problem is that, no matter what, often xp remembers credentials
across logons with the same or different user, thus not asking for the
password or exiting saying that you can't connect on the same server
with different credentials. I've tried everything that came up in my
mind which is specifying /persistent:no in the net use command and
putting net use * /d /yes all around the place (unmapping with net use
driveletter: /d /yes each and every conceivable drive letter in
advance, just to play safe). Still, users, complain that drives get not
mapped or they don't see what they are supposed to (because of
different permission of the last user). Do you have any idea? How can I
cut, sever, kill, destroy and piss on the corpse of the connections *no
matter what*? Oh, before I forget, the computers are not in a domain.
The thing works like this: a little script in the Startup folder
connects to a share with a limited account, copies the main script in
local, deletes the share and passes control to the main script which
takes care of the rest. Here there are the script (slighty modified to
cut swears and the like).

Thank you very much

This goes in the startup folder:

@ECHO OFF
start /wait net use * /delete /yes >nul 2>nul

start /wait net use z: \\192.168.3.88\sys$ wlogonuser /user:wlogonuser
/persistent:no

if exist z:\ (
copy /Y z:\script\Login_archivi_Gr.bat
%TEMP%\Login_Archivi_Gr.bat >nul 2>nul
start /wait net use z: /d /yes >nul 2>nul
start /wait net use * /delete /yes >nul 2>nul
call %TEMP%\Login_Archivi_Gr.bat
)
rem net use z: /d >nul 2>nul

------
This is the called script (the main one)


@ECHO OFF

net use z: /d /yes >nul 2>nul
net use y: /d /yes >nul 2>nul
net use x: /d /yes >nul 2>nul
net use w: /d /yes >nul 2>nul
net use v: /d /yes >nul 2>nul
net use u: /d /yes >nul 2>nul
net use t: /d /yes >nul 2>nul
net use s: /d /yes >nul 2>nul
net use r: /d /yes >nul 2>nul
net use q: /d /yes >nul 2>nul
net use p: /d /yes >nul 2>nul
net use o: /d /yes >nul 2>nul
net use n: /d /yes >nul 2>nul
net use m: /d /yes >nul 2>nul
net use l: /d /yes >nul 2>nul
net use k: /d /yes >nul 2>nul
net use j: /d /yes >nul 2>nul
net use i: /d /yes >nul 2>nul
net use h: /d /yes >nul 2>nul
net use g: /d /yes >nul 2>nul
net use f: /d /yes >nul 2>nul
net use e: /d /yes >nul 2>nul


start /wait net use * /delete /yes >nul 2>nul
net use \\faxsrv faxusr /user:faxusr /persistent:no
rem net time \\faxsrv /set /yes >nul 2>nul


set gruppo=eof
if /I %USERNAME%==dany set gruppo=Contab
if /I %USERNAME%==laura set gruppo=Contab
if /I %USERNAME%==arianna set gruppo=Contab
if /I %USERNAME%==marco set gruppo=Contab
if /I %USERNAME%==alessandra set gruppo=Acquisti
if /I %USERNAME%==sara set gruppo=Acquisti
if /I %USERNAME%==danilo set gruppo=Acquisti

if /I %USERNAME%==administrator set gruppo=admin

goto %gruppo%


rem -------------------------------------------------------------------
rem mappature
rem -------------------------------------------------------------------

:archivi
start /wait net use t: /d >nul 2>nul
start /wait net use t: \\192.168.3.88\archivi /user:%USERNAME%
/persistent:no
goto eof

:archivi_sec
start /wait net use u: /d >nul 2>nul
start /wait net use u: \\192.168.3.88\archivi_sec
/user:%USERNAME% /persistent:no
goto eof

:as400
start /wait net use i: /d /yes >nul 2>nul
start /wait net use i: \\192.168.3.129\qdls /user:asusr
/persistent:no
start /wait net use f: /d /yes >nul 2>nul
start /wait net use f: \\192.168.3.129\qdls /user:asusr
/persistent:no
goto eof

rem -------------------------------------------------------------------
rem gruppi
rem -------------------------------------------------------------------
:acquisti
rem echo %gruppo%
call :archivi
goto eof

:Contab
rem echo %gruppo%
call :archivi
call :archivi_sec
call :as400
goto eof

:admin
rem echo %gruppo%
net use t: /d >nul 2>nul
net use t: \\192.168.3.88\archivi /user:admin /persistent:no
net use u: /d >nul 2>nul
net use u: \\192.168.3.88\archivi_sec /user:admin
/persistent:no
call :as400
goto eof

:eof
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top