Skip to main content

Cloud

Mass password resets in BPOS

Following on from mass BPOS account activations you can now perform mass password resets with the latest Microsoft Online Services Migration Tools. The PowerShell script below will read in a list of BPOS accounts and reset the password. The two fields you need in the CSV file are the email address and desired password. See the BPOS password requirements before establishing a new password. In the script below you can choose not to force the user to change the password you assign to them by changing the value of “-ChangePasswordOnNextLogon:$true” to “-ChangePasswordOnNextLogon:$false”.
To run this you must have admin privileges in BPOS and you must have the MSOL Migration Tools installed locally. Save this text with a PowerShell extension (i.e. massPwdChg.ps1) and open a Migration Command Shell and run the command by typing “.massPwdChg.ps1”. Make sure the paths in the script exist or change them to suit your needs (i.e. “C:Migration” and “C:MigrationScriptLogs”). The input file is assumed to be massPwdChg.csv.
Here’s a sample CSV file format:
name,mail,passwd
”Test Account”,Testaccount@contoso.com,P@ssw0rd

 
# 
# Microsoft PowerShell Source File -- Created with SAPIEN Technologies PrimalScript 2009
# 
# NAME: massPwdChg.ps1
# 
# AUTHOR: Erik Enger , PointBridge
# DATE : 11/03/2009
# 
# COMMENT: Use this script to perform a mass password change of BPOS accounts
#
# Note: This script requires the Microsoft Exchange Transporter snapin
# Modify the default PowerShell profile to add the Quest Snap-In
#
# c:windowssystem32windowspowershellv1.0profile.ps1
#
# add-pssnapin Microsoft.Exchange.Transporter
# ==============================================================================================
cls
# Get the login ID for the BPOS admin account
write-host 'Enter the username for the MS Exchange Online admin (i.e. admin@contoso.com): '
$bposlogin = Read-Host
 
# Get the password for the BPOS admin account in a secure fashion (display * for password)
write-host 'Enter the password for the MS Exchange Online admin (i.e. admin@contoso.com): ' -foregroundcolor yellow -BackgroundColor darkmagenta
$bpospwd = read-host -assecurestring
Write-Host
 
# Form the BPOS encrypted credential information and store it in a variable to be passed to upcoming commands
$bposcred = new-object -typename System.Management.Automation.PSCredential -argumentlist $bposlogin, $bpospwd
Write-Host
 
write-host "`n`n`n"
 
"************************************************************************************************"
 
import-csv c:migrationmassPwdChg.csv | foreach {
 
## Start a Transcript
$file="C:MigrationScriptLogs"
$file+= $_.name +"-massPwdChg.log"
"************************************************************************************************"
Start-Transcript -Path $file -NoClobber:$false
Write-Host "Resetting BPOS password for:" $_.name
Date
"************************************************************************************************"
# Set the password and prompt for change on next logon
Set-MSOnlineUserPassword -Identity $_.mail -Password $_.passwd -ChangePasswordOnNextLogon:$true -Credential $bposcred -Verbose
## Stop the log
Date
Stop-Transcript
"************************************************************************************************"
Write-Host `n`n`n
}

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

PointBridge Blogs

More from this Author

Follow Us
TwitterLinkedinFacebookYoutubeInstagram