I’m currently trying to write a small service to delete one directory and all the files contained within it, there is one issue which I don’t know how to resolve which is that the users don’t have persmissions to access the folder or update it, so I’m trying to run the delete as an administrator from within AD. Is there any way I can do this from within a service? As the service will be run on the system login via a small script to start it.
Any help would be appreciated.
Thanks
You can expose the native “LogonUser” methods and use them to impersonate logging on as another user. I’ve used this successfully in other projects.
Fresh Click Media did an article about this and wrote a sample Impersonate class: –> http://www.freshclickmedia.com/blog/2008/11/programmatic-impersonation-in-c/
Using it is quite simple: