Get IP address of network printer (once mapped)? VB.NET 2003 (pref) / 2010 Exp

Hi Experts,

Is it possible to get a network printers IP Address once mapped to my machine?

e.g.
1. I map printer through run \\print server\printername
2. I would like to (either) specifiy a single printer through its UNC path or
just interigate all mapped printers and have them show in textbox on my WINDFORM.

I'm getting tired having to delv through printer properties for port data :(

I searched through several web articals:

http://www.robvanderwoude.com/2kprintcontrol.html
http://www.robvanderwoude.com/batchcommands.html#PRNCFG
http://technet.microsoft.com/en-us/library/cc754632.aspx

... but i guess i need an expert - right ;)

I found the following code below, but I'm not sure how it make it work with what i'm trying to do.

Thanks,
Rob
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        ' Example of how to use this subroutine:
        AddNetworkPrinter("HP LaserJet 1320 PCL 6", "//myserver/Printer", True, True)
    End Sub

    ''' <summary>
    ''' Adds a Network Printer to the computer
    ''' </summary>
    ''' <param name="printerName">Name of the Printer you'd like to add</param>
    ''' <param name="networkPath">The path of the networked printer</param>
    ''' <param name="useExistingDriver">Don't overwrite existing driver</param>
    ''' <param name="setDefaultPrinter">Set as the default printer</param>
    ''' <remarks></remarks>

    Public Shared Sub AddNetworkPrinter(ByRef printerName As String, ByRef networkPath As String, _
     Optional ByRef useExistingDriver As Boolean = 0, Optional ByRef setDefaultPrinter As Boolean = 0)

        Dim cmdToSend As String = "rundll32 printui.dll,PrintUIEntry /in /m " & Chr(34) & printerName & Chr(34) & " /f " & networkPath
        If useExistingDriver Then cmdToSend += " /u" '  /u = use the existing printer driver if it's already installed
        If setDefaultPrinter Then cmdToSend += " /y" '  /y = set printer as the default
        Shell(cmdToSend, AppWinStyle.Hide) ' execute the command

    End Sub

Open in new window

RobertoFreemanoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CodeCruiserCommented:
The title and description do not match. Do you want to get the IP of connected printer or do you want to connect to a network printer?
0
RobertoFreemanoAuthor Commented:
Hi CodeCruiser,

Sorry for the confusion: Get IP of connected printer please CodeCruiser but if possible connect to a network printer too ;)
0
RobertoFreemanoAuthor Commented:
1. Get IP of connected printer please
2. if possible, connect to a network printer too ;)
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

RobertoFreemanoAuthor Commented:
Gosh! It's a bit over my head ...
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RobertoFreemanoAuthor Commented:
Thanks CodeCruiser,

I have a few ideas but will need to take into the office to test... brb ;)
0
rexifelisCommented:
are you wanting to just get the ip address?

just command prompt

ping UNCprintername

and it should return the ip address of said printer... if within the same subnet/network
... might not be able to do this across domains...
0
RobertoFreemanoAuthor Commented:
Thanks CC ;)
0
CodeCruiserCommented:
Glad to help :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.