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)
and when I'm running it I get " Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) "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
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![]()




)
Reply With Quote
