Solved

net command to verify a password

Posted on 2014-03-24
5
499 Views
Last Modified: 2014-03-25
is there a net command or similar command prompt command that can be used to test a domain username/password to see if the password is correcr... to avoid the need to have to rdp to a system or login to the domain via these credentials. please provide a syntax.
0
Comment
Question by:pma111
  • 3
5 Comments
 
LVL 35

Accepted Solution

by:
Joseph Daly earned 250 total points
ID: 39951530
You could always try a shift right click run as other user. This will prompt for a username and password. If you enter it correctly the program will launch, incorrectly you will get an error.

Notepad works well for this.
0
 
LVL 29

Assisted Solution

by:becraig
becraig earned 250 total points
ID: 39951538
You will want to look into
System directory services AccountManagement Namespace

http://msdn.microsoft.com/en-us/library/system.directoryservices.accountmanagement.aspx

C# example from the link below:
public bool ValidateCredentials(
	string userName,
	string password,
	ContextOptions options
)

Open in new window



You will also find a detailed example at Microsoft:
http://msdn.microsoft.com/en-us/library/bb300969%28v=vs.110%29.aspx
0
 
LVL 3

Author Comment

by:pma111
ID: 39951540
could do with a command as there are tons I need to check and was going to find a quick shell script to run them in bulk.
0
 
LVL 29

Expert Comment

by:becraig
ID: 39951556
We can try from powershell as well:


$AccountName = "domain\user"
$AccountPassword = "password"
$AccountPasswordset = $AccountPassword  | ConvertTo-SecureString -AsPlainText -Force
$Credential = new-object -typename System.Management.Automation.PSCredential -argumentlist $AccountName,$AccountPasswordset

			try{
				$psi.username = $AccountName
				$psi.password = $AccountPasswordset
				$pwd_ok = [System.Diagnostics.Process]::Start($psi)
			} catch {
				write-host "$($psi.domain)\"
				Write-Host $psi.username "Incorrect Password, try again" -Foregroundcolor RED
			}

Open in new window




You can also import all this from a csv file and loop through the accounts, I can make the edit for that if needed.


I have not tested this as yet but it should work since it is from a piece of script I wrote a long time ago for something similar.
0
 
LVL 29

Expert Comment

by:becraig
ID: 39951880
Something simpler for simply testing if you can access a unc path for example you can use net use:
net use \\unc\path /user:username password

It all depends on what you are really trying to do.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you try to extract and to view the contents of a Microsoft Update Standalone Package (MSU) for Windows Vista, you cannot extract the files from the MSU. Here we are going to explain how to extract those hotfix details without using any third pa…
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question