Solved

How to delete a network printe using a simple script?

Posted on 2008-10-07
7
258 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

So you have two Windows Servers and you have a directory/folder/files on one that you'd like to mirror to the other?  You don't really want to deal with DFS or a 3rd party solution like Doubletake. You can use Robocopy from the Windows Server 200…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

16 Experts available now in Live!

Get 1:1 Help Now