Solved

net command to verify a password

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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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 …

810 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