PowerShell - update "Manager"?

Posted on 2011-10-25
Last Modified: 2012-05-12
I've been looking into some PowerShell scripts for AD, as well as some of Quest ActiveRoles cmdlets, but am not sure how I could do something like this.

Can you update a user's Manager/Direct Report (see AD properties > organization > manager) with a command? And could you also read the names from a text file and update the Manager name for each person (per line)?
Question by:garryshape
    LVL 37

    Accepted Solution

    Sure. Create a csv file with the following headings and put the username in the first heading and the manager's username in the second.


    Then run the attached command in Quest AD
    import-csv | foreach{$user,$manager = $_.username,$_.manager
    set-qaduer -identity $user -manager $manager}

    Open in new window


    Author Comment

    Cool thanks a lot.

    So if I wanted to do it for a single user, would it be:
    Set-QADUser -identity JDoe -manager RDoe (to make RDoe the manager of JDoe)?

    Open in new window

    LVL 37

    Expert Comment

    by:Adam Brown
    Pretty much, yes.

    Author Closing Comment

    Thank you dear friend

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Introduction You may have a need to setup a group of users to allow local administrative access on workstations.  In a domain environment this can easily be achieved with Restricted Groups and Group Policies. This article will demonstrate how to…
    I thought I'd write this up for anyone who has a request to create an anonymous whistle-blower-type submission form created using SharePoint 2010 (this would probably work the same for 2013). It's not 100% fool-proof but it's as close as you can get…
    This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
    The viewer will learn how to dynamically set the form action using jQuery.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now