Link to home
Start Free TrialLog in
Avatar of GTKINC
GTKINC

asked on

Is there a way in my current login script to delete any printers/drive mappings before its starts with the new ones?

This question is pretty straight forward.  Is there a way in my current login script to delete any printers/drive mappings before its starts with the new ones?  I'm running a SBS 2K3 server.  Thanks in advance.  
Avatar of Andrew Davis
Andrew Davis
Flag of Australia image

presuming you are running vbs script
there are a few ways of doing this depending if you know what printers they are likley to have.
read http://www.computerperformance.co.uk/Logon/Logon_Remove_Printer.htm
this will send you in the right direction.

Regards
Andrew
SOLUTION
Avatar of murgroup
murgroup
Flag of United States of America image

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
Avatar of Steve Knight
To delete all drive mappings and printer mappings to LPT ports from a batch file without knowing the mappings

net use * /delete /y

hth

Steve
Avatar of GTKINC
GTKINC

ASKER

i'm using the .bat file.  They are ran when the users log in.  Their batch files depend on what group they are in.  Hope this helps.
ASKER CERTIFIED SOLUTION
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
This is the line needed to delete any printers/drive mappings
bye Gastone Canali
::
::  rm-net-mappings.cmd
:: *** delete any printers/drive mappings ***
::
:: *** remove all network disk mappings
net use * /del /y
:: Turn off persistence
net use /persistent:no
:: *** remove all network printer mappings
reg delete HKCU\Printers\Connections /f
::  *** end
::
::  rm-net-mappings.cmd
:: *** delete any printers/drive mappings ***
::
:: *** remove all network disk mappings
net use * /del /y
:: Turn off persistence 
net use /persistent:no
:: *** remove all network printer mappings
reg delete HKCU\Printers\Connections /f
::  *** end

Open in new window

again ...
net use * /del /y
net use /persistent:no
:: more elegant way to remove mapped printer
WMIC /INTERACTIVE:Off PRINTER where network='TRUE' delete

Bye Gastone
Avatar of GTKINC

ASKER

Thanks for your time.