WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Functions

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

RunwithLogon with no password


Question:

Im using the RunWithLogon function to run a program as the currently logged on user. I know it sounds weird, but if you look here you'll see why I'm doing this - http://blogs.msdn.com/aaron_margosis/archive/2004/07/24/193721.aspx. The RunWithLogon syntax requires a user i.d. and password. I can easily get the currently logged on user's user i.d., but can't get their password without asking for it. I want to be able to use the RunWithLogon function without asking the user for their password. Does anyone know of a way to do this? Cached credentials perhaps?

Answer:

RunWithLogon() is using the underlying CreateProcessWithLogonW() Win32 API function. That function requires that you supply *ALL* of the credentials for the authentication that is going to be attempted.

Cached credentials come into play when you attempt to logon to a workstation that's disconnected from the network. In that situation, the LSA authentication services within Windows will perform the necessary crunching of the user-supplied credentials, and then compare those to the cached domain credentials that are stored by the authentication service. If they match, then the cached access token is used to complete the authentication request. If they don't match, you don't get to use cached credentials.

You can't go the reverse route - take an existing user and obtain their password back from the cached credentials that are stored on the system.


Article ID:   W16981
File Created: 2007:07:03:14:27:28
Last Updated: 2007:07:03:14:27:28