Jump to content

network printer, autopartitioning


Recommended Posts

I'm not really sure where this should go, but I'm having issues with unattended instalation of a network printer, and HP LaserJet 5. The problem is, this is not shared like \\share\printer, but it's connected directly to the network, and is identified by IP_xxx.xxx.xxx.xxx. Does anyone know how to set this up?

also (just to save posting another topic), I would like for my CD to automatically quick format the entire hard drive with the NTFS file system, how can I do that?

Link to comment
Share on other sites


Not sure about the network printer, but the reformatting is done via an entry in WINNT.SIF

[Unattended]
   Repartition=Yes

Since the default behavior for Windows XP is to quick format your chosen partition with the NTFS file system, this is the only line that is needed.

Link to comment
Share on other sites

The following is a Microsoft KB Article Reference: http://support.microsoft.com/?kbid=314486 - How to Add Printers with No User Interaction in Windows XP (Also KB189105 – Windows 2000):

Windows 2000, XP and 2003 have the capability to have a Network Printer so that it is automatically available to any user that logs on at that computer.  Unfortunately, the Add Printer wizard does not expose that capability - it can only add a Network Printer for the currently logged on user.  So to add a printer globally (for all users) you have to a different tool.

The PrintUIEntry function of printui.dll has options for performing most printer management functions.  It can perform these functions either on the same computer that printui.dll is running on or on another computer (i.e remotely).  The general purpose rundll32 command can be used to execute PrintUIEntry function of printui.dll.

Some things to keep in mind:

1. The function for adding a printer globally is /ga.  Globally in this context means that the action applies to all and any users that happen to logon at the target computer. 

2. The corresponding function for deleting a printer globally is /gd.  If you attempt to delete a global printer by using the Delete function in the printer's context menu, it will appear to delete, but will reappear when the Print Spooler service is restarted. 

3. Only printers previously added using the /ga function can be deleted using /gd. 

4. You have to have administrative rights and permissions on the target computer to use these functions.

5. If a printer is added remotely using the /ga function, it will not appear to the user until the Print Spooler service is restarted or the user next logs on.  You can restart the print spooler remotely using these commands:

    sc \\targetcomputername stop spooler

    sc \\targetcomputername start spooler

Like any other commands these commands can be used inside a command file, such as addglobalprinterremotely (see below).

Here's a way of "installing" network printers on workstations so that they are available to all users (remotely).

The file at AddGlobalPrinterRemotely.cmd has the commands for adding a network printer remotely and restarting the print spooler on the target computer.

If you prefer not to download .cmd files, paste (or key) the following into your own .cmd file

  rundll32 printui.dll,PrintUIEntry /ga /c\\%1 /n\\%2

  start /wait sc \\%1 stop spooler

  start /wait sc \\%1 start spooler

Then, at a command prompt key:

addglobalprinterremotely targetcomputername printservername\printersharename

For example to install the printer \\pserver\p1 on the workstation abc:

addglobalprinterremotely abc pserver\p1

To find out more about the rundll32 printui.dll,PrintUIEntry command, key (case sensitive):

    rundll32 printui.dll,PrintUIEntry /?

Here's some details:

/c specifies the computer which is to be the target of the requested action.

If /c is not specified, the local computer is assumed.  In other words, the /c option allows you to do printer management things on other computers without actually physically being there (i.e. remotely).

/n specifies which network printer is to be, in this case, added using the printer's UNC name (\\servername\printersharename).

/? is understood by PrintUIEntry to be a request for its Help information, which is displayed in a separate window.

The "start /wait" command runs the command (e.g. sc), then waits until the command actually terminates.  Stopping and starting the print spooler takes a while, so without this, the next command (e.g. sc ... start spooler) may run before the spooler is actually stopped.

Usage: rundll32 printui.dll,PrintUIEntry [options][@commandfile]

/a[file]  binary file name

/b[name]  base printer name

/c[name]  unc machine name if the action is on a remote machine

/dl delete local printer

/dn delete network printer connection

/dd delete printer driver

/e display printing preferences

/f[file]  either inf file or output file

/ga add per machine printer connections

/ge enum per machine printer connections

/gd delete per machine printer connections

/h[arch]  driver architecture one of the following, Alpha | Intel | IA64 | x64

/ia install printer driver using inf file

/id install printer driver using add printer driver wizard

/if install printer using inf file

/ii install printer using add printer wizard with an inf file

/il install printer using add printer wizard

/in add network printer connection

/j[provider] print provider name

/k print test page to specified printer, cannot be with command when installing a printer

/l[path]  printer driver source path

/m[model]  printer driver model name

/n[name]  printer name

/o display printer queue view

/p display printer properties

/q quiet mode, do not display error messages

/r[port]  port name

/s display server properties

/Ss Store printer settings into a file

/Sr Restore printer settings from a file

    Store or restore printer settings option flags that must be placed at the end of command:

  2 PRINTER_INFO_2

  7 PRINTER_INFO_7

  c Color Profile

  d PrinterData

  s Security descriptor

  g Global DevMode

  m Minimal settings

  u User DevMode

  r Resolve name conflicts

  f Force name

  p Resolve port

/u use the existing printer driver if it's already installed

/t[#]  zero based index page to start on

/v[version]  driver version one of the following, Windows 95, 98 and Me | Windows NT 4.0 | Windows NT 4.0 or 2000 | Windows 2000 or XP | Windows XP

/w prompt the user for a driver if specified driver is not found in the inf

/y set printer as the default

/Xg get printer settings

/Xs set printer settings

/z do not auto share this printer

/Y do not auto generate a printer name

/K  changes the meaning of /v and /h to accept 0,1,2,3, respectively for Windows x64 and Windows IA64 | Windows NT x86 | Windows NT Alpha_AXP | Windows 4.0

/Z share this printer, can only be used with the /if option

/? help this message

@[file]  command line argument file

/Mw[message] show a warning message before committing the command

/Mq[message] show a confirmation message before committing the command

/W[flags]  specifies flags and switches for the wizards (for APW & APDW)

r make the wizards to be restart-able from the last page

/G[flags]  specifies global flags and switches

w suppress setup driver warnings UI (super quiet mode)

Examples:

Run server properties:

rundll32 printui.dll,PrintUIEntry /s /t1 /n\\machine

Run printer properties:

rundll32 printui.dll,PrintUIEntry /p /n\\machine\printer

Run add printer wizard localy:

rundll32 printui.dll,PrintUIEntry /il

Run add printer wizard on \\machine:

rundll32 printui.dll,PrintUIEntry /il /c\\machine

Run queue view:

rundll32 printui.dll,PrintUIEntry /o /n\\machine\printer

Run inf install:

rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /f %windir%\inf\ntprint.inf /r "lpt1:" /m "AGFA-AccuSet v52.3"

Run add printer wizard using inf:

rundll32 printui.dll,PrintUIEntry /ii /f %windir%\inf\ntprint.inf

Add per machine printer connection:

rundll32 printui.dll,PrintUIEntry /ga /c\\machine /n\\machine\printer /j"LanMan Print Services"

Delete per machine printer connection:

rundll32 printui.dll,PrintUIEntry /gd /c\\machine /n\\machine\printer

Enumerate per machine printer connections:

rundll32 printui.dll,PrintUIEntry /ge /c\\machine

Add printer driver using inf:

rundll32 printui.dll,PrintUIEntry /ia /c\\machine /m "AGFA-AccuSet v52.3" /h

"Intel" /v "Windows 2000 or XP" /f %windir%\inf\ntprint.inf

Add printer driver using inf:

rundll32 printui.dll,PrintUIEntry /ia /K /c\\machine /m "AGFA-AccuSet v52.3" /h "Windows NT x86" /v 3

Remove printer driver:

rundll32 printui.dll,PrintUIEntry /dd /c\\machine /m "AGFA-AccuSet v52.3" /h "Intel" /v "Windows 2000 or XP"

Remove printer driver:

rundll32 printui.dll,PrintUIEntry /dd /K /c\\machine /m "AGFA-AccuSet v52.3" /h "Windows NT x86" /v 3

Set printer as default:

rundll32 printui.dll,PrintUIEntry /y /n "printer"

Set printer comment:

rundll32 printui.dll,PrintUIEntry /Xs /n "printer" comment "My Cool Printer"

Get printer settings:

rundll32 printui.dll,PrintUIEntry /Xg /n "printer"

Get printer settings saving results in a file:

rundll32 printui.dll,PrintUIEntry /f "results.txt" /Xg /n "printer"

Set printer settings command usage:

rundll32 printui.dll,PrintUIEntry /Xs /n "printer" ?

Store all printer settings into a file:

rundll32 printui.dll,PrintUIEntry /Ss /n "printer" /a "file.dat"

Restore all printer settings from a file:

rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat"

Store printer information on level 2 into a file :

rundll32 printui.dll,PrintUIEntry /Ss /n "printer" /a "file.dat" 2

Restore  from a file printer security descriptor:

rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat" s

Restore  from a file printer global devmode and printer data:

rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat" g d

Restore  from a file minimum settings and resolve port name:

rundll32 printui.dll,PrintUIEntry /Sr /n "printer" /a "file.dat" m p

Link to comment
Share on other sites

u understood that ??? :P lol

Nope! Not in the least. What I understand is this:

rundll32 printui.dll,PrintUIEntry /if /b "Test Printer" /f %windir%\inf\ntprint.inf /r "IP_157.57.50.98" /m "HP Laserjet 4000 Series PCL" /Z

is how it's done (from the page he linked to), and i think I can figure out how to modify it to work with my printer...if not, expect another post in here on tuesday ;)

edit: tried it, and according to everything I can find, it should work, once it's run on a computer that can actually access the printer, but for the moment, it doesn't create the port (MS says this is because it can't find the printer).

Link to comment
Share on other sites

Not sure about the network printer, but the reformatting is done via an entry in WINNT.SIF

[Unattended]
   Repartition=Yes

Since the default behavior for Windows XP is to quick format your chosen partition with the NTFS file system, this is the only line that is needed.

one last quick thing...I used nlite, so I currently have

[Unattended]
    FileSystem= *

does that have to be changed or removed at all?

Link to comment
Share on other sites

one last quick thing...I used nlite, so I currently have

[Unattended]
    FileSystem= *

does that have to be changed or removed at all?

I believe so. Either remove it completely or change it to:

FileSystem = ConvertNTFS

That should sort it for you.

Link to comment
Share on other sites

This is what you need to do. Install the printer manually as you would regularly with all the port configurations et al. Once the printer is installed, and configured properly, open up regedit and export this registry key.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\PrintServer\Ports\IP_157.57.50.98].

(It may be different name, but you that is where your configured port should be)

Mine looks something like this

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\PrintServer\Ports\LK96DB9D_P1]"User Name"=""

"Banner Page"=dword:00000000

"TCP/IP Address"="LK96DB9D"

"Port"=dword:00000000

"PostScript"=dword:00000000

"RegiRetry"=dword:00000005

"NetTimeout"=dword:00000000

"BoxType"=dword:00000004

So in your case the TCP/IP Address would be "157.57.50.98". The rest of the values will be the same or maybe a lil bit different. But make sure to export all the values under this registry key. Save it as printer.reg or something like that.

Now before you install the network printer using the printui command, import this registry into your installation.

Here are some examples of my printer installation

Install printer using inf file.

rundll32 printui.dll,PrintUIEntry /y /if /b "Konica PP1350W" /f %systemdrive%\Apps\Printer\MXP____Q.INF /r "LK96DB9D_P1" /m "KONICA MINOLTA PagePro 1350W"
Konica PP1350W - Printer name I choose to have.

LK96DB9D_P1 - The TCP/IP port name you imported previously.

KONICA MINOLTA PagePro 1350W - The default name for the printer in the inf file. This has to be exactly the same as in the inf file.

rundll32 printui.dll,PrintUIEntry /Xs /n "Konica PP1350W" attributes -enablebidi

Disable bidirectional support on the printer. Default is enabled.

RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "Konica PP1350W"

Make printer the default printer (if you have other printers).

Link to comment
Share on other sites

alright, thanks. I'm going to give it a shot without those registry entries, only because I have already burned 3 cds for this, but if that doesn't work, I'll just manually install the printer for now, and look up those reg entries so I can add 'em.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...