I am monitoring a directory from a Windows Service. I had plans to run this Windows Service under the Local SYSTEM account but I am not sure if that works. I have access to usernames and passwords.
The problem is that I need to monitor a Network Drive. So, I thought I could combine WinAPI functions LogonUser and LoadUserProfile. I believe that I must load the user profile in order to access drives.
I have run some tests. I have 3 different accounts. The 1. SYSTEM account, and 2. admin account which has the network drives, and 3. a new admin account.
When I run as 1. I am able to user LogonUser but not LoadUserProfile.
When I run as 2. I am able to LogonUser and LoadUserProfile and get access to the network drive. This works if I login with:
* LOGON32_LOGON_INTERACTIVE
* LOGON32_LOGON_SERVICE
When I run as 3. I am able to LogonUser but only load the user profile if I use:
* LOGON32_LOGON_NEW_CREDENTIALS
However, the user that is impersonated is not the one I want but the user is still the one for the service.
I don't know what I am doing wrong or what I have todo to achieve this. Please tell me if it is possible todo this under the SYSTEM account in any way. If not, I would like to know how to get LoadUserProfile to work in the example with the user 3. - a new user admin account.
thanks
The problem is that I need to monitor a Network Drive. So, I thought I could combine WinAPI functions LogonUser and LoadUserProfile. I believe that I must load the user profile in order to access drives.
I have run some tests. I have 3 different accounts. The 1. SYSTEM account, and 2. admin account which has the network drives, and 3. a new admin account.
When I run as 1. I am able to user LogonUser but not LoadUserProfile.
When I run as 2. I am able to LogonUser and LoadUserProfile and get access to the network drive. This works if I login with:
* LOGON32_LOGON_INTERACTIVE
* LOGON32_LOGON_SERVICE
When I run as 3. I am able to LogonUser but only load the user profile if I use:
* LOGON32_LOGON_NEW_CREDENTIALS
However, the user that is impersonated is not the one I want but the user is still the one for the service.
I don't know what I am doing wrong or what I have todo to achieve this. Please tell me if it is possible todo this under the SYSTEM account in any way. If not, I would like to know how to get LoadUserProfile to work in the example with the user 3. - a new user admin account.
thanks