Results 1 to 6 of 6

Thread: Inside my DLL- get list of printers

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    3

    Inside my DLL- get list of printers

    I'm using Visual Studio 2015. I have a Visual Basic DLL.
    Inside the DLL, I'm trying to get a list of printers.
    I get an "Unspecified error " on


    strComputer = "."

    objWMIService = GetObject("winmgmts:\\ & strComputer & "\root\cimv2")


    the "GetObject" is where I get the error.

    Overview- I have a web page. I want the user to push a button. It calls
    my DLL that is on the server and it submits a document to the print job.
    The printing is done on the server, NOT the client printer.



    Suggestions ?

    TIA
    Shall42

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Inside my DLL- get list of printers

    Is this for ASP.NET or for a Windows Form Application?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2012
    Posts
    3

    Re: Inside my DLL- get list of printers

    This is for ASP.NET

  4. #4
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Inside my DLL- get list of printers

    My first guess would be permissions, I am not sure if the default account IIS uses to run applications has permissions to WMI.

    IIRC IIS defaults to "Network Service" as the user. You could either grant permissions to this account or it might be more preferable to create a new user account to run your application under and make sure this account has access to WMI.

    https://technet.microsoft.com/en-us/...(v=ws.11).aspx
    https://technet.microsoft.com/en-us/...(v=ws.10).aspx

  5. #5
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,715

    Re: Inside my DLL- get list of printers

    Thread moved to the ASP.Net forum.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  6. #6
    PowerPoster JuggaloBrotha's Avatar
    Join Date
    Sep 2005
    Location
    Lansing, MI; USA
    Posts
    4,286

    Re: Inside my DLL- get list of printers

    You all do realize that with this being asp.net, anything you do printer wise will run on the IIS Webserver so you'll need to have a printers(s) connected to it (not the end user who's browsing the website) which is extremely rare in the first place and besides that, what would you even want to have printed directly from your web server(s) anyways?
    Currently using VS 2015 Enterprise on Win10 Enterprise x64.

    CodeBank: All ThreadsColors ComboBoxFading & Gradient FormMoveItemListBox/MoveItemListViewMultilineListBoxMenuButtonToolStripCheckBoxStart with Windows

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