Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Hi Seniors,
 
I have developed a program to collect system login and logout informations from Windows Event logs.
 
This program creates a text file on local & server machine.
 
It's working fine with my Windows system that has enough Admin rights.
 
But when i run my application on another Windows computer (exe - copied and pasted) it requires 'Administrator Password'. then it's working fine.
 
The problem is, we have nearly 100 machines in a Domain and we need to collect Logs from the same for 200 users working on 100 machines.
 

Thanks,
Rajan.
Posted 13-Aug-14 4:22am
Edited 13-Aug-14 4:45am
Kim Togo26.3K
v3
Comments
Maciej Los at 13-Aug-14 9:26am
   
Yes, you do.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

If this is a genuine program, I would suggest looking at a windows service program. This can then be set to run with sufficient privileges to access the event log and do what you need to do.
 
Then you just need a method of deployment, so companies use Group Policy managed deployment to deploy software, or you need to go around each machine, login as an administrator and install the service.
 
An alternative to the service approach is to create a Scheduled task that runs as an administrator on each machine, again I believe (although I'm not certain) this is something that can be deployed by scripting/Group Policy. The scheduled task then just runs your program at the required frequency.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

In Windows, there is a feature called UAC (User Access Control), what will prompt the user if the program is accessing informations that need higher rights than standard user.
 
If the program is running as a part of Group Policy Login script in Windows, it will have Local Administrator rights and will be able to get informations that need higher rights, then a standard user.
  Permalink  
Comments
npsrajan at 14-Aug-14 4:23am
   
Is this task can be done using "Microsoft.Win32.SystemEvents" is the best alternative way? Or any disadvantages with this.? Please advise.!
Kim Togo at 14-Aug-14 4:35am
   
Hi.
Microsoft.Win32.SystemEvents will not work, SystemEvents event like SessionSwitch is only for current logged in user.
And the current user has no admin rights.
 
Alternative method is to use Windows Task Scheduler, if it is Windows 7 or Windows 8. Task can run when any user logged on and you can define what security rights that Task runs under.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.150302.1 | Last Updated 13 Aug 2014
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100