Microsoft
Software
Hardware
Network
Question : Delete network printer(s) using vbs or WSH
I research MS KB, but no solution to my problem... here it goes.
Little Background
1. I had a login.bat script that map users; profiles and everything else, it also call a c:\printer.bat in the local machine to get the printer connected to that specific machine (all W2K so \\servername\pr1) was ok, now I am moving away from .bat file to vbs or wsh login to W2k, my script maps users profiles drives and everything else by GPO, no problem there,
PROBLEM: I need to have a script that will erase any existing printers in the profile of the user as he/she login and then attach the printer that belong to that specific workstation (no local printers involve)
E.g. 1st floor \\server\pr1
2nd floor \\server\pr2
but when user moves from 1st floor to 2nd floor the pr1 needs to get erase and pr2 needs to be added (back and forth)
thank you
Answer : Delete network printer(s) using vbs or WSH
That might help you.
set o_net = CreateObject("WScript.Netw
ork")
Set o_prt_dic = CreateObject("Scripting.Di
ctionary")
'------------------- Enable Error Handler
on error resume next
'------------------- Get User Printers
err.clear
set usr_prt = o_net.EnumPrinterConnectio
ns
if err.number = 0 then
For i = 0 to usr_prt.Count - 1 Step 2
o_prt_dic.add usr_prt.Item(i+1), i
Next
end if
'------------------- Remove Old Printers
if o_prt_dic.exists("\\server
\printer")
then
o_net.removeprinterconnect
ion "\\server\printer", true, true
end if
Random Solutions
Storage Group and database limit
Installing Drivers for Ethernet controller and card
FormMail.pl CGI ERROR
Citrix Secure Access Disabling Auto Start
F8 Produces a blue screen with gears as the picture
Can Illustrator, Fireworks, or other Adobe app draw box diagrams with anchored connectors.
8 GB DDR2 PC-5300 RAM installed, shows up in BIOS, but in not in XP
Bind Listbox to Different Table and Have it Show Relationship Data
RDP wont connect, no error message
Wanted to open a new word document through OLE