Solved

How to delete a network printe using a simple script?

Posted on 2008-10-07
7
264 Views
Last Modified: 2011-10-19
Hi All,
I was able to map printer via a script using the following line START "" "\\server\printer"
This line is located in a simple batch file. It works great. There is a small thing though, each workstation has bunch of other old network mapped printers that I would like to clean. Is there a way to add a line prior to adding these printers that will enable me to delete every previous network mapped printer?

This is PRE R2 version, so I cannot use the GPO for that. I know, I could really use this thing now :)

Thanks for your help.
SP.
0
Comment
Question by:SpiderPig
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 4

Accepted Solution

by:
Chris James earned 250 total points
ID: 22662415
0
 
LVL 18

Assisted Solution

by:sk_raja_raja
sk_raja_raja earned 250 total points
ID: 22662483
0
 
LVL 7

Expert Comment

by:enzogoy
ID: 22665299
SP
We use dif. way to add and remove printer with you.  We have a vb script to add the printers to the machine everytime that machine log on.  Therefore we only need to remove that printer out of the script.  Doing it our way, you have to change to way you add your printers at the moment.  Let me know if you're interested.

enz
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 

Author Comment

by:SpiderPig
ID: 22666374
Quick question about the vbs script. Where do I implement it? Will this work with the batch file I have under script logon? Can I paste this into a regular text editor and save as VBS or do I need a special editor?

Thanks this is a good information.

Eidan.
0
 
LVL 7

Expert Comment

by:enzogoy
ID: 22668211
vb script is just a script file somehow like your batch file but different language.  There are several editors for it but notepad is good enough if you don't mind.  I personally use notepad for it.  From your batch file, you only need to call it to run the printer.vbs (printer.vbs is your filename) or you even able to run it through AD GPO.  I assign the printer base on their location therefore I use AD to deploy it to computers group.

I'll post the script and how to deploy it through AD or Batch file tomorrow morning when I come to work.

enz
0
 

Author Comment

by:SpiderPig
ID: 22670933
Great, Thank you.
0
 
LVL 7

Expert Comment

by:enzogoy
ID: 22674285
For example you save the vbs in the \\ServerName\Sharedrive\ShareFolder with file name is departmentAPrinters.vbs.

Now, this is how you add the vbs in to your batch file:
In your batch file just add this line:

Start \\ServerName\ShareDrive\ShareFolder\deparmentAPrinters.vbs

Now, this is how to run through AD:

Create a GPO for a group of computers and edit that GPO.
Under User Configuration => Policies => Window Settings => Script (Logon/Logoff)
Double click in Logon => Add => enter \\ServerName\ShareDrive\ShareFolder\deparmentAPrinters.vbs or browse to the .vbs file.
After you apply it, all computers under that group will add printers in that script if they logon.

I have attached the file for you.  You only need to change a few things in the file and save the file name as vbs instead of txt.  I save the file as txt because I can't add the .vbs file on here.  In the file I have a few comment in there, hope you able to understand my english. :)

Let me know if you need more explaination.

enz
departmentAprinters.txt
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick step-by-step overview of installing and configuring Carbonite Server Backup.
This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question