Solved

How to delete a network printe using a simple script?

Posted on 2008-10-07
7
263 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
How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

 

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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Trust relationship SBS2011 - > Windows 2003 3 52
Event ID: 1008 / Source: Microsoft-Windows-Perflib 2 245
2003 Server DNS/FS errors 6 81
AD account Auto logoff 1 57
Numerous times I have been asked this questions that what is it that makes my machine log on so slow, there have been cases where computers took 23 minute exactly after taking password and getting to the desktop. Interesting thing was the fact th…
I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

732 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