Solved

net command to verify a password

Posted on 2014-03-24
5
501 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

738 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