1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<#
.NOTES
===========================================================================
Created on: 9/23/2014 11:07 AM
Created by: Cole Lavallee
Filename: EnableUsers.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>

Import-Module ActiveDirectory

$newpwd = ConvertTo-SecureString -String 'p@ssw0rd' -AsPlainText -Force

#Import users from CSV

$users = Get-Content "C:Scriptsusers.csv"

#For each user in users: Pull in the users from the CSV then enable the account. Change the password to the password above and force to change password on next login.
foreach ($user in $users)
{
Get-ADUser $user | Enable-ADAccount
Set-ADAccountPassword -Identity $user -NewPassword $newpwd -Reset -PassThru | Set-ADUser -ChangePasswordAtLogon $true
}