TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Suresh.Joseph
NA
1
0
monnitoring Win32_PrintJob (WMI) as a service
Sep 22 2004 7:39 PM
Hi, I have a windows service in C# (.NET framework 1.1) running on Windows XP SP1. This service essentiallt starts a printjob watcher. Please see the code snippet below. queryInterval = ((SchedulerData)obj).Interval/1000; //queryInterval=1; this.printEventWatcher = new System.Management.ManagementEventWatcher(); this.printEventWatcher.Query = new System.Management.EventQuery("SELECT * FROM __InstanceCreationEvent WITHIN "+queryInterval+" WHERE TargetInstance ISA \"Win32_PrintJob\""); string hostName = Dns.GetHostName(); this.printEventWatcher.Scope = new System.Management.ManagementScope("\\\\"+hostName+"\\root\\CIMV2"); printEventWatcher.EventArrived+=new EventArrivedEventHandler(this.Arrived); printEventWatcher.Start(); This service fires the EventArrived event when running as my login account. i.e When the service is run as sjoseph and I login as sjoseph and print documents, I see the events being fired. But, when the service is run as NT AUTHORITY\SYSTEM (Local System account), and I login as sjoseph and print documents the EventArrived event is not fired. The query interval was set to 1 second in both the above cases. Could anyone help me with this? What does the scope in the event watcher signify? Isn't the data in the WMI tables visible to all users in a PC? Thanks, Suresh Joseph
Reply
Answers (
0
)
MSMQ
help on barcode reader