Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

net command to verify a password

Posted on 2014-03-24
5
Medium Priority
?
507 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 1000 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 1000 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

Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

Question has a verified solution.

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

In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
In this modest contribution, I want to share with the IT community (especially system administrators, IT Support Engineers and IT Help Desks) about Windows crashes/hangs and how to deal with these particular problems.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

876 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