I need to execute some scripts in the context of different users. I know the username and password.
I am using the following sequence of code (essentials)
hUser = LogonUser(,,LOGON32_LOGON_INTERACTIVE,
<- this call fails. GetLastError() returns ERROR_PRIVILEGE_NOT_HEL
How can I find out which particular privilege is not being held
Alternatively - apart from runas, are there other options for running a script just once during the next time the user logs on? In particular, on this system, that will be the very first time the user logs on