If you would like to bulk update your EmployeeHireDate first create a csv file containing 1 row for each user you would like to update each row should contain 2 columns the first column should be the UPN of the user you would like to update and the second column should be the EmployeeHireDate in the following format yyyy/mm/dd for example:
[email protected], 2024/01/22
You can then use the below PowerShell script to run through the csv file updating each Employees EmployeeHireDate
# Set the path to the CSV file
$csvPath = "C:\Dev\Users.csv"
# Set the delimiter for the CSV file
$delimiter = ","
# Set the column names for the CSV file
$columnNames = "UserPrincipalName","EmployeeHireDate"
# Import the CSV file
$users = Import-Csv -Path $csvPath -Delimiter $delimiter -Header $columnNames
# Loop through each user in the CSV file
foreach ($user in $users) {
$dateFormat = "yyyy/MM/dd"
$dateObject = [DateTime]::ParseExact($user.EmployeeHireDate, $dateFormat, [System.Globalization.CultureInfo]::InvariantCulture)
# Update the EmployeeHireDate
Update-AzADUser -UPN $user.UserPrincipalName -EmployeeHireDate $dateObject
}
# Output a message when the script is complete
Write-Host "User information has been updated."