Results 1 to 16 of 16

Thread: Printers' name in Password protected server

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2009
    Posts
    7

    Printers' name in Password protected server

    Hi everyone, I'm new here
    I looked hours on the net to find the answer to my prb...
    I need to check all the printers of my faculty by sending a test page to everyone of them. And I want to do that with a little program in VB...
    All the printers are in the same server.

    I've found this piece of code :
    It should get the names and put them in a list box (the following code) and them send the print request (any suggestion about that will be very welcome too )

    Code:
            Dim moReturn As Management.ManagementObjectCollection
            Dim moSearch As Management.ManagementObjectSearcher
            Dim mo As Management.ManagementObject
    
            moSearch.Scope.Path.DefaultPath.Server() = "server_name"
    
            Try
                moSearch = New Management.ManagementObjectSearcher("Select * from Win32_Printer")
                moReturn = moSearch.Get
                For Each mo In moReturn
                    ListBox1.Items.Add(mo("name"))
                Next
            Catch ex As Exception
                MsgBox(ex.Message)
            Finally
                moReturn = Nothing
                moSearch = Nothing
                mo = Nothing
            End Try
    and when I'm running it I get " Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) "
    PS : I have the password of course, and I enter it in the terminal before executing the code.

    If someone can halp me it will great.
    Thanks a lot
    Last edited by daka90; Sep 9th, 2009 at 11:26 AM.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width