web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Updating Active Direct...
Power Automate
Unanswered

Updating Active Directory Users in Power Automate Desktop

(0) ShareShare
ReportReport
Posted on by 8
how to update user manager name? I am looking at the connector and there doesnt seem to be a way.
 
I have tried powershell scripts that work on the IDE but is not working in PA Desktop. I am able to update other user details but not the manager details despite using the DN to update the user's manager info
I have the same question (0)
  • Expiscornovus Profile Picture
    33,175 Most Valuable Professional on at
    Updating Active Directory Users in Power Automate Desktop
     
    Just to double check. Are you using the Set-ADUser cmdlet with the -manager parameter?
    https://learn.microsoft.com/en-us/powershell/module/activedirectory/set-aduser?view=windowsserver2025-ps#-manager

    Can you share the setup of your scripting action as well in Power Automate desktop flow?
     
     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel
  • JL-14081054-0 Profile Picture
    8 on at
    Updating Active Directory Users in Power Automate Desktop
     
    Thank you for your reply. Ive set the variables in Power Automate Desktop and then pulling them into the script which you can see below:
     
    It manages to update the postcode, just not the manager DN 
     
    # --- CONFIGURABLE VALUES ---
    $Cred     = New-Object System.Management.Automation.PSCredential ($Username, $Password)
    $ID = '%AccName%'
    $loc      = '%locPostCode%'             # new postal code value
    $mgr = (Get-ADUser -Identity $ID).DistinguishedName
    # ----------------------------
     
    # For logging
    $logPath = 'C:\Temp\ADUser_Log.txt'
    if (-not (Test-Path (Split-Path $logPath))) {
        New-Item -ItemType Directory -Force -Path (Split-Path $logPath) | Out-Null
    }
     
    Write-Host "Running Set-ADUser as $Username to update PostalCode to $loc ..."
     
    Start-Process powershell.exe `
        -Credential $Cred `
        -ArgumentList "-NoProfile -ExecutionPolicy Bypass -Command `"Import-Module ActiveDirectory; Set-ADUser -Identity '$ID' -PostalCode '$loc' -Manager '$manDN' -ErrorAction Stop; Write-Output 'SUCCESS: PostalCode updated to $loc' | Out-File -FilePath '$logPath' -Append`"" `
        -Wait -WindowStyle Hidden
     
    Write-Host "Finished. Check $logPath for results."
     
    Any help appreciated thank you
  • Expiscornovus Profile Picture
    33,175 Most Valuable Professional on at
    Updating Active Directory Users in Power Automate Desktop
     
    I would start by validating the Get-ADUser line. Have you double checked if the DN is returned in that line?

    Can you add a line like the below?
     
    Write-Host $mgr
    Alternatively,  have you tried using the objectGUID, objectSid or sAMAccountName instead, those attributes are also allowed for the manager parameter
    https://learn.microsoft.com/en-us/powershell/module/activedirectory/set-aduser?view=windowsserver2025-ps#-manager


     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard