Solved

How to delete a network printe using a simple script?

Posted on 2008-10-07
7
259 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
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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
home folder path for users 4 58
Auslogics BoostSpeed 9 software 5 60
Backup DHCP Server 8 94
Active Directory delegation of control to a user 3 80
I guess it is not common knowledge to most Wintel engineers/administrators: If you have an SNMP-based monitoring system in your environment (and it's common to have SNMP or Syslog) it's reasonably easy to enable monitoring of the Windows Event logs,…
Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now