Solved

net command to verify a password

Posted on 2014-03-24
5
493 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 28

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 28

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 28

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
If you get continual lockouts after changing your Active Directory password, there are several possible reasons.  Two of the most common are using other devices to access your email and stored passwords in the credential manager of windows.
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now