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?

PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,942 questions
Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
24,581 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Andreas Baumgarten 121.1K Reputation points MVP 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.