LogonUser Function

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
 
W

Wilson, Phil

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top