Link to home
Start Free TrialLog in
Avatar of BrianSDG
BrianSDGFlag for United States of America

asked on

How can I get rid of old drive mapping?

We run a Windows domain with a Windows 2003 domain controller.  We have XP Pro SP3 clients.  When a user logs on there is script that runs that first clears all previously mapped drives (@echo off
net use * /delete /yes) then maps the drives needed and then runs an antivirus update.  The problem is that there are drive mappings that are no longer needed that keep getting mapped after every logon.  I have disconnected them untold number of times and they keep getting remapped.  I installed the Microsoft User Hive Profile Cleanup service to no joy.  I have searched the registry trying to find a key that I could delete to stop these old paths from being mapped and after logon they keep getting re-added to the registry.  How do I get rid of, and stay rid of, the old drive mappings?
Avatar of Jamsb
Jamsb

Check the keys under:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2
>>>>>When a user logs on there is script that runs that first clears all previously mapped drives

You should be able to find where this logon script is bound to a user/group. Find the association to the script file, which will lead you to the location of the logon script file. Edit the file, and remove the shares that you don't want. This should prevent them showing up.
Avatar of BrianSDG

ASKER

I did, as I mentioned above, after I delete the MountPoints2 keys and then reboot or log out and log back in they get rewritten to the registry and thus re-appear mapped in My Computer.
Are there multiple logon scripts perhaps? Check Jamsb's suggestion for a locally entered manual map. Here is also the default file location for scripts:

%SystemRoot%\sysvol\sysvol\<domain DNS name>\scripts



Deleting them out of the script file should have taken care of it, which leads me to believe there are multiple scripts
alikaz3 - The logon script is on our primary domain controler in C:\WINDOWS\SYSVOL\sysvol\domainname\scripts.  It is called as part of the AD setting for my user profile and it is a script that only runs for me.  My script is supposed to get rid of old mappings and map the ones I want but it doesn't get rid of the old ones and causes drive letter conflicts.
ASKER CERTIFIED SOLUTION
Avatar of SuBDivisions23
SuBDivisions23

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@echo off
net use * /delete /yes

net use K: \\admnas\SYSADM
net use L: \\goodlink\e$
net use M: \\NASMAC\nasmac
net use O: \\CCGFS\files
net use P: \\CCGFS\Files\Archived Resources
net use S: \\MAIN\Scans

net use Z: \\nas\files\alliance_nt

REM \\MAIN\OFCSCAN\AUTOPCC

\\CCGACCT\OFCSCAN\AUTOPCC

net start "Trend Micro Client/Server Security Agent Listener"

net start "Trend Micro Client/Server Security Agent Personal Firewall"

net start "Trend Micro Client/Server Security Agent RealTime Scan"
Avatar of Gary Case
Go to C:\Documents and Settings\<User Name>\NetHood\  and delete all of the current contents (the appropriate ones will be recreated on next login).   You may have to do this not only for the main user but also for "All Users" and "Default User" depending on when the old mappings were made.
... Note:  You have to have "Show hidden files and folders" enabled in Explorer to see NetHood
garycase - I did with no joy.  The old mappings comeback.
Did you delete all of the entries for ALL of the user accounts?
Are there any configuration settings in the programs you're loading that might reference the old mappings?
I double checked all the users and there no mappings in Nethood.  
Going out on a limb, but i thinnk you have to add the Persistent line...

Try this on the script:

@echo off
net use * /delete /yes /persistent:yes

net use K: \\admnas\SYSADM
net use L: \\goodlink\e$
net use M: \\NASMAC\nasmac
net use O: \\CCGFS\files
net use P: \\CCGFS\Files\Archived Resources
net use S: \\MAIN\Scans

net use Z: \\nas\files\alliance_nt

REM \\MAIN\OFCSCAN\AUTOPCC

\\CCGACCT\OFCSCAN\AUTOPCC

net start "Trend Micro Client/Server Security Agent Listener"

net start "Trend Micro Client/Server Security Agent Personal Firewall"

net start "Trend Micro Client/Server Security Agent RealTime Scan"
SuBDivisions23 - Thanks, you got me thinking in the right direction. I switched the sections around and it worked.  But I don't know why. I took the drive mapping section of the script and put it after the anti virus update section and the old drives stopped being re-mapped. Although there is nothing in AUTOPCC that would have caused the problem.