Getting the default login information

  • Thread starter Thread starter Guest
  • Start date Start date
There is no default login information for a machine. The closest thing
I can think of is the default profile settings on a new machine for when a
new user profile is created on a machine. Is this what you mean, or are you
looking for credentials? You won't be able to get credentials from a
machine, since password information is not stored on the machine.
 
If you are looking for the current user logged in then you can do something
like this:

private string m_LoggedInAs;
m_LoggedInAs =
System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString();
m_LoggedInAs = m_LoggedInAs.Substring(m_LoggedInAs.IndexOf("\\") + 1);

Adrian.
 
Hi,


WinDev said:
How can I get/set the dafault login information for a machine?

What u mean with "default user info" ?
Are you talking about the user used when the machine log in without asking
password you can use WindowsIdentity as usual
 
WinDev said:
How can I get/set the dafault login information for a machine?

How about these:

Environment.UserDomainName
Environment.UserName

Assuming you want the currently logged on user's credentials.

If you want the domain and account name used to do an automatic log on,
you have to go this registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

And look at the DefaultUserName and DefaultDomainName values.
 

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

Back
Top