Updating Employee Hire Date with PowerShell.

Stefan Diedericks 125 Reputation points
2023-06-05T07:25:42.9333333+00:00

Is the a script a can use to update EmployeeHireDate with PowerShell while referencing a csv list for the list of employees?

Windows for business | Windows Server | User experience | PowerShell
Microsoft Security | Microsoft Entra | Microsoft Entra ID
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2023-06-05T12:55:24.7733333+00:00

    Hi @Stefan Diedericks ,

    this should be possible using the Update-AzADUser cmdlet of the AzureAD PowerShell module.

    Read the content of the CSV file first (UPN or ObjectID is required) and use a foreach loop for every line in the CSV file.

    A sample could look like this (not tested!):

    $csvFile = "users.csv" # assuming there is a column named UPN
    $hireDate = (Get-Date).Date # Get date of today
    Import-Csv -Path $csvFile | ForEach-Object {
        Update-AzADUser -UPNOrObjectId $_.UPN -EmployeeHireDate $hireDate
    }
    

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards

    Andreas Baumgarten


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.