?
Solved

Unlock and reset password at the same time

Posted on 2014-11-17
3
Medium Priority
?
16 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 56

Accepted Solution

by:
McKnife earned 1000 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 1000 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

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…
Active Directory can easily get cluttered with unused service, user and computer accounts. In this article, I will show you the way I like to implement ADCleanup..
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…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…
Suggested Courses

770 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