Windows

### Next

• 1. Capturing a printer port
Does anyone know how to capture a printer port in Windows 2000? I need to take a network printer and map it to LPT1... Thanks, Dan
• 2. HP Printer prints on shutdown of computer
Weird as it may seem, my HP 1215 printer is printing a one line sequence of greek (ascii)?? characters when I shut down my system... anyone have any clues??
• 3. How can I change clents printers to look at a new windows 2000 printserver
After successfully migrating the drivers from an older windows 2000 printserver to a new windows 2000 printserver I need to change the clients printers to look at the new windows 2000 printserver. How can I do this? the old change printer utility in the NT 4.0 resource won't work on windows 2000 or Xp pcs Help Sam
• 4. Permissions Necessary to Install Network Printers
We are presently testing various security settings and we ran into an unexpected problem. If you do the following: 1) Install Win2K Pro from scratch on a blank system 2) Install updates from MS 3) Use the security configuration and analysis mmc snap-in to analyze and configure each of the folling templates using separate databases C:\WINNT\inf\def\defltwk.inf C:\WINNT\security\templates\basicwk.inf C:\WINNT\security\templates\ocfilesw.inf C:\WINNT\security\templates\securews.inf Then a normal user cannot install a network printer that everybody has access to and receives the following message: "You do not have sufficient access to your machine to connect to the selected printer." Prior to applying the security templates above, the user could install the printer and if you make the user a local administrator, the user can install the printer. So, first we disabled "Prevent users from installing printer drivers" in the Local Security Policy. Didn't work. Then we also gave the local user group modify permissions on the C:\WINNT\system32\spool folder. Didn't work. Then we also gave the local user group modify permissions on the C:\WINNT folder. Didn't work. Then we gave local user group full control of HKLM\Software including classes Didn't work. We are at a loss as two where the lack of permissions lie.
• 5. Memory Leak i driver
Hi Is there anybody that has a tools for testing drivers memory leak, or testing incompabilitet with other drivers ? Br thomas

Hi
Has anyone deployed printers on clustered print servers using prnadmin.dll?
I have had a go but am having a few issues.

Jeff



Can anyone from MS tell me the license policy on redistributing this
dll.  I need to include it as part of the install process of my
company's product and have noticed that it is not a free download of
any kind.

Marc Lampcov


I'm using prnadmin.dll via a Word VBA macro (for those who want to read it, I'll paste the code to the end of this message) to setup a file printer to generate PCL5-compliant image files for faxing software that we're using.
I'm using a printer driver that is bundled in Windows, the HP LaserJet III, and installing the printer to the port "FILE:".
The installation goes perfectly, and I then set some properties of the printer, such as the comment, the datatype, the location, etc....

Now, here are my questions:

Another macro then prints to that printer, generating a fax file, and I've noticed that the printer icon in the System Tray lingers around for a long time (perhaps 30 seconds to 1 minute) after the file is produced and the status, according to the tooltip when I hover my mouse pointer over the System Tray icon, is "1 document(s) pending".  Double-clicking the icon brings up the queue window, which shows no documents pending.  Any ideas on why it may be hanging around so long?  It doesn't seem to have a deleterious effect; I can run the printing code immediately and produce another file.

Secondly, I have tentatively deployed this to a Win2k Terminal Services server with about 10 users.  The server has about 10 networked printers installed.  I noticed after I deployed my macros and the users had installed and were printing to the PCL5 fax printer (all via the VBA macros), that most of the networked printers somehow obtained a status of "Opening", and that my code was hanging at the line
Call oMaster.PrinterGet("", FAXPRINTER, oPrinter)
Trying to retrieve the fax printer in order to test for its existence.
This happened twice.  I had to reboot the server each time, and am watching it closely now.
Any ideas on using prnadmin in a multi-user environment?
Of course, I have no proof that the situation was caused by prnadmin, but the coincidence is suggestive.

thanks,

-Peter

Private Sub InstallPrinter()
Const FAXPRINTER as String = "PCL5 fax printer"
Static Registered As Boolean
Dim oPrinter As Object
Dim oMaster As Object

On Error Resume Next

Set oMaster = CreateObject("PrintMaster.PrintMaster.1")
Set oPrinter = CreateObject("Printer.Printer.1")

If Err.Number = 429 Then  ' prnadmin.dll has not been registered
' attempt to register it, then call this sub again, but only once.
If Not Registered Then
Registered = True
Call InstallPrinter
End If
Exit Sub
End If

' check for the existance of the fax printer
Call oMaster.PrinterGet("", FAXPRINTER, oPrinter)

If Err.Number = -2147023095 Then
' the printer has not yet been installed, so install it using prnadmin.dll from the W2k reskit.
Err.Clear
oPrinter.ServerName = "" ' local computer
oPrinter.PrinterName = FAXPRINTER
oPrinter.DriverName = "HP LaserJet III"
oPrinter.PortName = "FILE:"
' DriverPath and InfFile both default to the standard location.  W2k and XP should install with support for the HP LaserJet III printer.
' If we change the printer or find that 2k/XP doesn't always support the HP LJ III, we need to bundle driver and inf files with our app and point DriverPath and InfFile to that location, which isn't hard to do.
If Err.Number = 0 Then
' set the properties of the just-installed printer
oMaster.PrinterGet "", FAXPRINTER, oPrinter
oPrinter.Comment = "PCL 5 fax printer"
oPrinter.Location = "Local Computer"
oPrinter.DataType = "RAW"
oPrinter.Default = False
oPrinter.Shared = False
oMaster.PrinterSet oPrinter
End If
End If

Set oPrinter = Nothing
Set oMaster = Nothing

End Sub



Hi!

I am working on a vbs script whose purpose is to delete all the old printers and drivers installed on the Client PCs of my domain and to re-install from scratch all the printers available at my company on every Client Machine.

For that I am using the "prnadmin.dll" library supplied with the "Windows 2003 Resource Kit".
In the documentation, it is written that in order to delete a Printer Driver, we have to use the following method:
"oMaster.DriverDel oDriver"
where "oMaster" is the PrintMaster object and "oDriver" the driver object.

Here is the code that I used:

----------------------------------------------------------------------
Dim oMaster		'ok
Dim oDriver		'ok
Dim oPrinter		'ok
Dim regEx

Set regEx= New RegExp
regEx.Pattern="CANON|HP|HEWLET|RICOH|EPSON|DOCUCENTRE|DOCUPRINT|DOCUCOLOR|LASER|LBP|DOCUWORKS|PRINTER"
regEx.Global=False
regEx.IgnoreCase=True

Set WshShell = Wscript.CreateObject("Wscript.Shell")

set oMaster = CreateObject("PrintMaster.PrintMaster.1")

For Each oDriver in oMaster.Drivers("")

if regEx.Test(oDriver.ModelName) Then
oMaster.DriverDel oDriver
End If
Next

----------------------------------------------------------------------

The error that I get is the following:

Line concerned: "oMaster.DriverDel oDriver"
Error:"The environment is incorrect"
Code:8007000A
Source:null

Could someone help me out with this cuz I spent quite a bit of time trying to find out  what was the problem but in vain...
Thanks in advance for any kind of help.
Julien.



Hi,

on W2K SP2, German I have no trouble to register the prnadmin.dll with
regsvr32.exe

With SP3 it doen't work, the message is: DllRegisterServer in
prnadmin.dll failed. Return code was 0x8007007e

Any Ideas?

Thanks  Martin


When I request a list of printers installed on a print server the script only
returns about a fourth of the actual results.  I am using the prnAdmin.dll
from the Resource Kit.  What is the problem?

set oMaster = CreateObject("PrintMaster.PrintMaster.1")

for each oPrinter in oMaster.Printers("\\ServerName")
Response.write oPrinter.PrinterName & "<BR>"
next

Thanks!