Get Printer status from window service using ManagementObject (WMI)

PSIUnit
PSIUnit used Ask the Experts™
on
Hi,

i am able to get printer status using ManagementObject (WMI) in a exe file.

but i am getting "Access denied" error if i use the same code in a window service.

C# / VB.NET




Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Have you tried assigning a user and password to the service.. Perhaps the default security settings prohibit it.  You can do this in services.. double click the service and select logon tab.

Author

Commented:
I tried that, but it is not helping me.
is the service configured to interact with desktop?  are you returning or showing any values to the user?
Expert Spotlight: Joe Anderson (DatabaseMX)

We’ve posted a new Expert Spotlight!  Joe Anderson (DatabaseMX) has been on Experts Exchange since 2006. Learn more about this database architect, guitar aficionado, and Microsoft MVP.

Commented:
i was trying to get status from another system, i changed the system name and pointed to local. and removed the user name and password. now it is working.  

thanks...
ah.. that would do it..    Permissions on that machine and all .. yup.. glad its working..

Author

Commented:
now it is working.  

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial