The following will work in NT4 and Win2K (the FOR line long, and ends with %%w)
new server name = NEWSERVER
old server name = OLDSYSTEM
@ECHO OFF
set SERVER=OLDSYSTEM
for /f "eol=c tokens=2,3" %%v in ('net use ^| find /i "%SERVER%"') do CALL :SwapShare
%%v %%w
GOTO :EOF
:SwapShare
set DRIVE=%1
set SHARE=%2
set SHARE=%SHARE:OLDSYSTEM=NEWSERVER%
net use %DRIVE% /D /Y
net use %DRIVE% %SHARE%
GOTO :EOF
==============================================================
ASB - http://www.ultratech-llc.com/KB/?File=~MoreInfo.TXT
==============================================================
"Trouble will rain on those who are already wet."
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Keystrokes are an Endangered Species:
http://www.shortkeys.com/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>-----Original Message-----
>From: Tom Grabowski [mailto:[EMAIL PROTECTED]]
>Sent: Thursday, August 23, 2001 12:59 PM
>To: NT System Admin Issues
>Subject: Changing Mappings after server re-name
>
>
>Does anyone know if it is possible to re-map existing drives
>through a log
>on script after changing a server name? This is the
>situation we have;
>We are 'upgrading', format, install fresh, and restore
>information, one of
>our servers from NT4 to 2000 and in the process we are
>renaming the server
>from APPS_SERVER to APPS2, to keep in line with Internet DNS naming
>standards. I know that there will be numerous people with
>mapped drives to
>this server such as "Prog on 'Apps_Server' (P:)". Is there
>a way through
>2000 logon scripts or, 3rd party software, that upon logon
>the users drive
>mappings can be reviewed and through the use of variables accomplish
>something like this;
>if %drive_leter% = 'Apps_Server' then net delete
>'Apps_Server' and Net Use
>'Apps2', to whatever drive letter the directory was
>originally mapped.
>We need to use a variable for the drive letter because there
>are numerous
>shared directories that are mapped to numerous different
>Drive Letters, most
>done manually by department or individual developers.
>
>Thanks in advance for any help.
>
>Tom Grabowski
>
http://www.sunbelt-software.com/ntsysadmin_list_charter.htm