How can I use CimCredential in Web Page to get Printer Status ?
-
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:
-
Dim Credentials As New CimCredential(PasswordAuthenticationMechanism.Default, domain, username, securepassword)
-
Session = CimSession.Create(computer, SessionOptions)
-
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.
-
-
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:
-
Dim Credentials As New CimCredential(PasswordAuthenticationMechanism.Default, domain, username, securepassword)
-
Session = CimSession.Create(computer, SessionOptions)
-
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.
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
-
-
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
Yea, I saw that reference too. Unfortunately, that path does not exist on my Win10 machine. Am I missing a feature?
-
Yea, I saw that reference too. Unfortunately, that path does not exist on my Win10 machine. Am I missing a feature?
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