Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How can I use CimCredential in Web Page to get Printer Status ?

How can I use CimCredential in Web Page to get Printer Status ?

Scheduled Pinned Locked Moved ASP.NET
sysadminhelpquestioncsharpasp-net
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    David Mujica
    wrote on last edited by
    #1

    I have successfully implemented code which uses ManagementObjectSearcher to query and return the status of printers on one of our servers. Now what I would like to do is use this code from an ASP.net web page so that my user community can view the status of those same printers. The problem is that the account that the webserver executes as does not have the appropriate permissions to retrieve the data. My research seems to point to a method to get the data where I would pass credentials while executing the query. The building blocks are:

    1. Dim Credentials As New CimCredential(PasswordAuthenticationMechanism.Default, domain, username, securepassword)

    2. Session = CimSession.Create(computer, SessionOptions)

    3. session.QueryInstances("@root\cimv2", "WQL", "SELECT * FROM Win32_Printer")

    However, I can't seem to find the proper reference to the Microsoft.Management.Infrastructure.dll My development environment is VS2015 / Win10 and I plan to deploy the web application to a 7.5 IIS server. Can someone help me find the correct dll location ? Am I approaching this problem correctly ? Thanks.

    Richard DeemingR 1 Reply Last reply
    0
    • D David Mujica

      I have successfully implemented code which uses ManagementObjectSearcher to query and return the status of printers on one of our servers. Now what I would like to do is use this code from an ASP.net web page so that my user community can view the status of those same printers. The problem is that the account that the webserver executes as does not have the appropriate permissions to retrieve the data. My research seems to point to a method to get the data where I would pass credentials while executing the query. The building blocks are:

      1. Dim Credentials As New CimCredential(PasswordAuthenticationMechanism.Default, domain, username, securepassword)

      2. Session = CimSession.Create(computer, SessionOptions)

      3. session.QueryInstances("@root\cimv2", "WQL", "SELECT * FROM Win32_Printer")

      However, I can't seem to find the proper reference to the Microsoft.Management.Infrastructure.dll My development environment is VS2015 / Win10 and I plan to deploy the web application to a 7.5 IIS server. Can someone help me find the correct dll location ? Am I approaching this problem correctly ? Thanks.

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      According to this thread[^], it should be in:

      C:\Program Files (x86)\Reference Assemblies\Microsoft\WMI\v1.0


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      D 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        According to this thread[^], it should be in:

        C:\Program Files (x86)\Reference Assemblies\Microsoft\WMI\v1.0


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        D Offline
        D Offline
        David Mujica
        wrote on last edited by
        #3

        Yea, I saw that reference too. Unfortunately, that path does not exist on my Win10 machine. Am I missing a feature?

        Richard DeemingR 1 Reply Last reply
        0
        • D David Mujica

          Yea, I saw that reference too. Unfortunately, that path does not exist on my Win10 machine. Am I missing a feature?

          Richard DeemingR Offline
          Richard DeemingR Offline
          Richard Deeming
          wrote on last edited by
          #4

          It looks like it's part of one of the Windows SDKs - either 8 or 10 should do. Windows 10 SDK - Windows app development[^]


          "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

          "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups