+ Post New Thread
Results 1 to 11 of 11
Windows Thread, An odd one... shared printer > IP port? in Technical; Bit of a strange problem really, we've got this app that's old school 16-bit style that can't find any printers ...
  1. #1
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,656
    Thank Post
    164
    Thanked 220 Times in 203 Posts
    Rep Power
    67

    An odd one... shared printer > IP port?

    Bit of a strange problem really, we've got this app that's old school 16-bit style that can't find any printers when they're shared network ones but if I manually add a direct TCP\IP port type local printer it goes through fine.

    Is there any way to somehow redirect this to the UNC shared printers via the print server without having to map every printer via direct TCP\IP?

  2. #2

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,172
    Thank Post
    868
    Thanked 2,699 Times in 2,288 Posts
    Blog Entries
    11
    Rep Power
    772
    There is a dirty way to do this for old 16bit apps. We had one that would only talk to a local printer so we had to do this for it to run.

    The idea is to set up a local printer on the box using the same driver as the network printer but pointed to Lpt2. You must make sure that LPT1 or 2 etc is not used in device manager and if so disable it. Then you set your network printer to map to the lpt port and when a document is printed to the local printer it is redirected to the network printer transparently.

    How to print to a network printer from an MS-DOS-based program in Windows XP
    How to redirect LPT port to IP printer

  3. Thanks to SYNACK from:

    gshaw (10th June 2009)

  4. #3
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,656
    Thank Post
    164
    Thanked 220 Times in 203 Posts
    Rep Power
    67
    Sounds like extra printers will have to be mapped for that program then... bit of a pain really... time for some nifty scripting to ask which printer to map as I'm not adding 20 extra printers every time the program runs

  5. #4

    Michael's Avatar
    Join Date
    Dec 2005
    Location
    Birmingham
    Posts
    9,262
    Thank Post
    242
    Thanked 1,568 Times in 1,250 Posts
    Rep Power
    340
    I had this problem recently with two applications: Eyeprofile v3 and Progress. They just won't print to any network printer. I've tried Synack's method in the past, but still no joy. The only method which works was to create a local port \\SERVER\PRINTSHARENAME install the drivers as normal and it works absolutely fine now.

  6. #5
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,656
    Thank Post
    164
    Thanked 220 Times in 203 Posts
    Rep Power
    67
    Aargh this is getting so frustrating now!

    It only works on either a local port mapped printer or the net use LPT1 direction with a manually added printer pointing to LPT1

    Found a nifty script to do it for me...

    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run ("cscript c:\windows\system32\prnport.vbs -a -o raw -r IP_192.168.x.x -h 192.168.x.x")
    WshShell.Run ("cscript c:\windows\system32\prnmngr.vbs -a -p " & chr(34) & _
    "StudyScan Printer" & chr(34) & " -m " & chr(34) & _
    "hp LaserJet 4" & chr(34) & " -r " & chr(34) & "IP_192.168.x.x")

    But it needs to run as admin!

    Found autoit that encrypts the runas command into an EXE but from Google search it can't call VBS files properly

    Need to do this via some kinda logon script as it's on a site license so manual mapping isn't an option. Tbh it's a real kludge to get printing to work but app is so old I can't see any other way

  7. #6

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,172
    Thank Post
    868
    Thanked 2,699 Times in 2,288 Posts
    Blog Entries
    11
    Rep Power
    772
    Bang, try this one. It should if run as a machine script on startup via GP it should have the nessisary privilages and will create a local IP printer port and a local printer mapping. Could be a little work to get the drivers etc right for your printer but a whole lot less work than going to every station.
    Script for installing local printers with TCP/IP port - Petri.co.il forums by Daniel Petri

    You could also try a scripted restore of the printer from a backup as at the end of this:
    Command Line Printer Control

    Use some other method to set up the ip port then use this command from MS:
    How to add printers with no user interaction in Windows

    Or implement it in a nullsoft installer:
    Install network printers on Windows XP - NSIS

  8. Thanks to SYNACK from:

    gshaw (15th June 2009)

  9. #7
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,656
    Thank Post
    164
    Thanked 220 Times in 203 Posts
    Rep Power
    67
    Just what I was hoping for... one last search result that hadn't yet popped up while Googling

    Will give the Petri script a whirl and see if it does the trick... because the software is so old it actually prefers to use a Laserjet 4 driver so shouldn't be a problem there

  10. #8
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,656
    Thank Post
    164
    Thanked 220 Times in 203 Posts
    Rep Power
    67
    Script works lovely but only as a local admin user... seems printer scripts can't be run at startup

    Back to the drawing board... is there anything like autoit that could wrap the vbs script up into an EXE with the run as credentials hidden?

  11. #9
    User3204's Avatar
    Join Date
    Aug 2006
    Location
    Wirral
    Posts
    769
    Thank Post
    55
    Thanked 66 Times in 62 Posts
    Rep Power
    34
    If you make the users into Power users does this allow them to install printers this way ?

    It gives extra access to stuff, but less than the local admin, I know staff are able to install printers onto our staff network machines, and they have power user access (because of SIMS).

    There is probably a better way to allow access for this...

  12. #10

    SYNACK's Avatar
    Join Date
    Oct 2007
    Posts
    11,172
    Thank Post
    868
    Thanked 2,699 Times in 2,288 Posts
    Blog Entries
    11
    Rep Power
    772
    Autoit does not play nice with VBS but you could try something like this:
    VBForums - View Single Post - [RESOLVED] Run script as administrator
    You can convert your vbscript script into EXE using this online converter http://www.vbs2exe.com
    Then try that under the machine logon or use autoit to repackage the exe as admin.

  13. #11
    gshaw's Avatar
    Join Date
    Sep 2007
    Location
    Essex
    Posts
    2,656
    Thank Post
    164
    Thanked 220 Times in 203 Posts
    Rep Power
    67
    That converter worked but no way to purchase it here (PO only) so was back to the drawing board. Was getting very frustrating but then as if by magic the lightbulb switched on and solution found

    Using printui.dll in a batch file called from autoit with admin credentials...

    Code:
    reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion\Print\Printers\The Printer Name"
    if %errorlevel% GTR 0 goto notinstalled
    exit
    
    :notinstalled
    rundll32 printui.dll,PrintUIEntry /if /b "The Printer Name" /f %windir%\inf\ntprint.inf /r "IP_10.0.0.1" /m "HP LaserJet 4"
    Then to call if from autoit...

    Code:
    $username = "user"
    $password = "pass"
    $domain = "domain"
    RunAs($username, $domain, $password, 0, @ScriptDir & "\addprinter.bat", "", @SW_HIDE)
    Compile to EXE to hide the credentials and it works perfectly! The batch file checks if the printer already exists and doesn't map a 2nd time so looking like the perfect solution... happy days!

SHARE:
+ Post New Thread

Similar Threads

  1. Add a shared printer for all users in XP
    By R1ch in forum Windows
    Replies: 7
    Last Post: 11th November 2010, 07:09 PM
  2. See Who Printed on Shared Printer?
    By jmair in forum Windows
    Replies: 5
    Last Post: 28th May 2009, 02:57 PM
  3. Replies: 6
    Last Post: 23rd June 2007, 08:44 AM
  4. Could not connect printer to LPR Port
    By CM786 in forum Windows
    Replies: 6
    Last Post: 13th April 2007, 09:37 AM
  5. Replies: 7
    Last Post: 27th September 2006, 08:19 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •