2 min readHow to set Custom Password for Office 365 User?

2 min readHow to set Custom Password for Office 365 User?

As admin of an Office 365 for business organization, you can reset
passwords for users who’ve forgotten their passwords. As we all aware
that admins can reset the password for Office 365 users from the Office
365 Admin portal, but they will not be able to set custom password for
users, instead a random password will be generated. In this blog, we see
about the different methods for setting custom password for Office 365
users.

How to set Custom Password for Single Office 365 User

Following PowerShell command is used to set Custom Password for Single
Office 365 User,

Steps involved:

  1. Reset the password for Office 365 user using “Set-MsolUserPassword”

    cmdlet.

Set-MsolUserPassword –UserPrincipalName –NewPassword
-ForceChangePassword $False

NOTE: To force the Office 365 user to change their password the next
time they sign in, modify the “ForceChangePassword” parameter to
“$true”.

How to set Custom Password for all Office 365 Users

Following PowerShell script is used to set Custom Password for all
Office 365 Users,

Steps involved:

  1. Get all Office 365 users using “Get-MsolUser” cmdlet.
  2. Reset the password for Office 365 user using “Set-MsolUserPassword”

    cmdlet.

$Users = Get-MsolUser $Users | Foreach-Object{ $User = $_
Set-MsolUserPassword -userPrincipalName $User.UserPrincipalName
–NewPassword -ForceChangePassword $False }

How to set Custom Password for Group Members

Following PowerShell script is used to set Custom Password for Office
365 Group Members,

Steps involved:

  1. Get all groups (Security or Distribution) using “Get-MsolGroup”

    cmdlet.
  2. Get all members of selected group using “Get-MsolGroupMember”

    cmdlet.
  3. Reset the password for Office 365 user using “Set-MsolUserPassword”

    cmdlet.
$GroupName =”GroupName” $Group = Get-MsolGroup
 |Where-Object{$_.DisplayName -like $GroupName} $members =
 Get-MsolGroupMember -GroupObjectId $Group.ObjectId $members |
 Foreach-Object{ $member = $_ Set-MsolUserPassword -ObjectId
 $member.ObjectId –NewPassword -ForceChangePassword $False }

How to set Custom Password for Bulk Office 365 users using CSV file

Following PowerShell script is used to set Custom Password for Bulk
Office 365 users using CSV file,

Steps involved:

  1. Import the userPrincipalName of Office 365 users from CSV file using

    “Import-Csv” cmdlet.
  2. Reset the password for Office 365 user using “Set-MsolUserPassword”

    cmdlet.
$csv = Import-Csv C:Users.csv Foreach ($line in $csv) {
 Set-MsolUserPassword -userPrincipalName $line.UserPrincipalName
 -NewPassword -ForceChangePassword $False }

Sample CSV File

Migrate Everything to Microsoft 365

Exchange Online SharePoint Online OneDrive For Business Microsoft Teams Microsoft Planner Viva Engage (Yammer) Microsoft Bookings Microsoft Forms Power Automate Microsoft Power BI Exchange Online SharePoint Online OneDrive For Business Microsoft Teams Microsoft Planner Viva Engage (Yammer) Microsoft Bookings Microsoft Forms Power Automate Microsoft Power BI
  • No Data Loss
  • Zero Downtime
  • ISO-Certified Protection

Start your free 15-days trial today !


4.5 out of 5