Solved

Unlock and reset password at the same time

Posted on 2014-11-17
3
14 Views
Last Modified: 2016-06-23
Hi Team,

Please help me developing a script (Powershell/ VBS/ command line) if i have to unlock and reset password at the same time for a handful of domain IDs

Distinguished name for the OU where i am having permission is mentioned below

OU=India,DC=XYZ,DC=com

Regards,
Gautam
0
Comment
Question by:Gautam Chaudhary
[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 Comments
 
LVL 54

Accepted Solution

by:
McKnife earned 250 total points
ID: 40447665
If you have a listfile (c:\temp\list.txt) with the corresponding usernames and you would like to give them a random password, just take:
for /f %%a in (c:\temp\list.txt) do net user %% /random /active
0
 
LVL 16

Assisted Solution

by:Joshua Grantom
Joshua Grantom earned 250 total points
ID: 40447873
Hey Gautum,

This will also set it where they have to change their password on next logon.

$newpwd = "NewPassword" -AsSecureString
$users = Get-Content C:\UserstoUnlock.txt | % { 
Unlock-ADAccount -Identity $_ -PassThru
Set-ADAccountPassword $_ -NewPassword $newpwd -Reset -PassThru | Set-ADuser -ChangePasswordAtLogon $True
}

Open in new window

0

Featured Post

Industry Leaders: 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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Always backup Domain, SYSVOL etc.using processes according to Microsoft Best Practices. This is meant as a disaster recovery process for small environments that did not implement backup processes and did not run a secondary domain controller that ne…
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

733 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