Solved

How to delete a network printe using a simple script?

Posted on 2008-10-07
7
260 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
setup share and NTFS permissions. 12 77
Best practices power settings GPO Win 10 4 96
Auditing domain account logon attempt, failure, lockout 2 81
Enterprise Mode 4 29
by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
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,…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

770 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