<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content
0D54z00007Xr5RSCAZOkta Classic EngineAdministrationAnswered2024-04-16T10:24:24.000Z2022-03-29T14:18:51.000Z2022-03-30T21:54:38.000Z

ir2cb (ir2cb) asked a question.

Update user attributes via PowerShell

Hello,

 

Currently, we create new users in bulk using OktaAPI PowerShell commands. The script creates and populates a new user account with information such as name, email, department, etc.

 

My question is, two part: Is there a way to "get" one of those values via PowerShell? "Get-Oktauser" returns all sorts of profile information, but is it possible to get just one attribute, like "lastName" or "manager"? "Get-Oktauser username -getAttribute $value" or something?

 

Second part is, is there a way to edit one of those values by PowerShell or other means? "Set-Oktauser username -setAttribute $newValue" or similar?

 

Thanks!


  • Paul S. (Okta, Inc.)

    @ir2cb (ir2cb)​ Thank you for using our community to help you troubleshoot. Your question is important to us. One of our product experts will chime in soon to assist you further.

  • ir2cb (ir2cb)

    Hi Paul,

     

    I did make some progress. Basically, I need to fetch the user's manager's email address. Since that isn't a profile attribute, I want to fetch it from a different direction and then write it back to the profile in the form of a custom attribute.

     

    So far, I've put together a PowerShell script that will query the user's manager's name, cross-reference that with Office365, and return the associated email address.

     

    # Get User’s Profile & Cross reference with Office

    $userProf = Get-OktaUser userName | select-object profile 

    Get-Mailbox $userProf.profile.manager | Select-Object PrimarySmtpAddress

     

    And it returns the smtp address. So far, this is great, I have the value we need.

     

    Now that I have it, I just need to write it back to the user's profile as a custom attribute, $managerEmail or similar.

     

    If there is a "Set-Oktauser -property = $value" command or similar, that would solve it!

    Expand Post
This question is closed.
Loading
Update user attributes via PowerShell