Forum Discussion
pck7101
Jun 16, 2023Copper Contributor
Updating EmployeeHireDate in Powershell
I'm surprised there are no posts about this yet. We are trying to update our employee's date of hires according to our HR team's records. There looks to be an option to update the value through Updat...
Andres-Bohren
Jun 17, 2023Iron Contributor
Hi pck7101
I've tested this with a CloudOnly account
Connect-AzAccount
$HireDate = (Get-Date).AddDays(-10)
Update-AzADUser -UPN email address removed for privacy reasons -EmployeeHireDate $HireDate
Get-AzADUser -UPN email address removed for privacy reasons -Select EmployeeHireDate | fl *hire*
With the Microsoft.Graph PowerShell you can also set the employeeLeaveDateTime
Connect-MgGraph -Scopes user.readwrite.all
$HireDate = (Get-Date).AddDays(-30)
$LeaveDate = Get-Date
Update-MgUser -UserId email address removed for privacy reasons -EmployeeHireDate $HireDate -employeeLeaveDateTime $LeaveDate
Get-MgUser -UserId email address removed for privacy reasons -Property EmployeeHireDate, employeeLeaveDateTime | fl *emp*
Regards
Andres