LogonUser Function

  • Thread starter Thread starter eliassal
  • Start date Start date
E

eliassal

I am trying to access a server using LogonUser function as follows
Dim returnValue As Boolean = LogonUser(Domain\UserName, MachineName,
password, LOGON32_LOGON_NEW_CREDENTIALS, LOGON32_PROVIDER_DEFAULT,
tokenHandle)

I get a token, and seems to me that I get authenticated. However when I
execute the following
Dim AllCountersCategories As PerformanceCounterCategory() =
PerformanceCounterCategory.GetCategories(myserver)
I get "Access denied" in spite of the fact that the user is a domain adnin
and when I use this logon to map a share from my laptop Ihave no issue.
Thanks for your help
 
It may be significant that it says of LOGON32_LOGON_NEW_CREDENTIALS that the
provider is required to be LOGON32_PROVIDER_WINNT50, rather than default.

You may also have to call LoadUserProfile - I don't know in your case that
the registry profile for that domain account is loaded when you call
LogonUser - I suspect it isn't, and that's a big difference between logging
on interactively with that account and assuming its credentials with
LogonUser.
 
Back
Top