How to Update EmployeeHireDate for Multiple Users with PowerShell
Question details
The user needs a PowerShell script to read employee data from a CSV file and perform a bulk update on the EmployeeHireDate property for multiple users.

- Product
- Microsoft Graph PowerShell
- Device & OS
- not provided
- Scenario
- Administrating user accounts and updating Active Directory employee records in bulk using data exported to a CSV file.
- Observed behavior
- The user needs to successfully map CSV data to specific user accounts using a reliable identifier like a UPN and apply the updated hire date.
Ensure you have Microsoft Graph PowerShell installed, possess the necessary API permissions (such as User.ReadWrite.All), and verify your CSV file has clear headers for the user identifier and hire date.
Use Microsoft Graph PowerShell to Bulk Update from CSV
Leverage the Microsoft Graph PowerShell SDK to iterate through your CSV file and update each user's hire date efficiently.
Microsoft Graph is the modern and recommended approach for managing Microsoft 365 user properties. By combining the Import-Csv cmdlet with Update-MgUser, you can automate property updates across thousands of accounts securely.
Create a CSV file containing at least two columns: 'UserPrincipalName' (or ObjectID) and 'HireDate'. Ensure the dates are formatted correctly (e.g., YYYY-MM-DD).
Open PowerShell as an Administrator and execute the command 'Connect-MgGraph -Scopes "User.ReadWrite.All"' to authenticate your session with the required privileges.
Use the following logic in your script: '$users = Import-Csv -Path "C:\path\to\file.csv"' followed by a loop: 'foreach ($user in $users) { Update-MgUser -UserId $user.UserPrincipalName -EmployeeHireDate $user.HireDate }'.

Manage Your CSV Data Seamlessly with WPS Office
While running PowerShell scripts requires Microsoft's specific IT administrative tools, preparing and cleaning the CSV files used for these bulk updates is effortless with WPS Office. It serves as a highly compatible, fast, and free alternative to Microsoft Excel for all your spreadsheet preparation needs.
- 1. Download WPS Office: Get the free WPS Office suite from the official website and install it on your computer.
- 2. Open your CSV file: Launch WPS Spreadsheet and open the CSV file containing your users' EmployeeHireDate data.
- 3. Edit and save: Update the headers and user data accurately, then save the file in CSV format to ensure it remains plain text for your PowerShell scripts.

Frequently Asked Questions
Can I update EmployeeHireDate using the older AzureAD PowerShell module?
Microsoft is deprecating the AzureAD module, so it is highly recommended to use the Microsoft Graph PowerShell SDK (Update-MgUser) to manage user properties like EmployeeHireDate moving forward.
What format should the hire date be in the CSV file?
Ensure the date in your CSV file is formatted in a standard ISO 8601 format (such as YYYY-MM-DD) or a recognizable standard date format so that Microsoft Graph can parse it correctly without regional format conflicts.
Why am I getting an 'Insufficient privileges' error when running the script?
This error occurs if your PowerShell session isn't authenticated with the necessary directory permissions. Ensure you run 'Connect-MgGraph -Scopes "User.ReadWrite.All"' and that your admin account is assigned the appropriate directory roles.




