Solved

add printer

Posted on 2014-11-21
5
157 Views
Last Modified: 2014-11-25
at work someone came up with this script

@ECHO OFF
rundll32 printui.dll,PrintUIEntry /ga /c\\%1 /n\\%2
pause

it is saved as

addprnt.cmd

so if I open a command prompt as admin, and run

addprnt.cmd  computername   printerservername\printername

it adds the printer for anyone that logges into the computer. and this works very well. so this same person made another scritp

@echo off
rundll32 printui.dll, PrintUIEntry /ge /c\\%1
pause

saved as

chkprnt.cmd

and is run at an elevated command prompt as

chkprnt.cmd  computername

this also seems to run well, however, I was wondering, is there another way to check for printers that are added with the first script? such as, would there be something in the registry or something like that? I ask because I ran the chkprnt.cmd command on a computer and only came up with one printer. For the computer I ran this on, I thought there would be more.
0
Comment
Question by:JeffBeall
  • 3
  • 2
5 Comments
 
LVL 15

Accepted Solution

by:
ZabagaR earned 500 total points
Comment Utility
There are printer utilities in windows 7 in C:\windows\system32\Printing_Admin_Scripts\en-US\

I copied those .vbs files to c:\windows\system32\ for my examples below:

cscript c:\windows\system32\prnmngr.vbs -l

That will LIST all printers locally, that's what the -l does

For a remote PC using your %1 parameter:

cscript c:\windows\system32\prnmngr.vbs -l -c %1

Basically -c is for "remote computer name"
0
 
LVL 1

Author Comment

by:JeffBeall
Comment Utility
I forgot about those scripts! I ran prnmngr.vbs -l locally on the computer, but it only showed the virtual printers like the office printer.
0
 
LVL 1

Author Comment

by:JeffBeall
Comment Utility
rundll32 printui.dll,PrintUIEntry /ga

must somehow make the printers not local printers. I was googling this problem and saw something about how network printers are supposed to be listed in the registry but I've tried so many things, I'm losing track. I don't suppose it would work to remove printers listed in the registry?
0
 
LVL 15

Expert Comment

by:ZabagaR
Comment Utility
I don't recall the reg key off hand but all printers are in a subkey in the registry. You could google that....plus run a reg query command to list them out. I'm out of the country on vacation for a week so I'm not going to be too much help at this point!
0
 
LVL 1

Author Closing Comment

by:JeffBeall
Comment Utility
Thank you for the help.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
OfficeMate Freezes on login or does not load after login credentials are input.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will give you a introduction in two parts how to utilize Windows Live Movie Maker to its maximum capability. This will be demonstrated using Windows Live Movie Maker on Windows 7 operating system.

763 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

10 Experts available now in Live!

Get 1:1 Help Now