PowerShell Script for Active Directory

This topic contains 6 replies, has 5 voices, and was last updated by Profile photo of Mark Prior Mark Prior 11 months, 3 weeks ago.

  • Author
  • #31721
    Profile photo of Matt McTaggart
    Matt McTaggart

    Hi. I am trying to create a Powershell script to run and create the following:
    *Active directory Account including Name, Display Name, Description, Office, and Email under the General Tab.
    *Under the Account tab, User logon name.
    *Under Profile tab, the path and logon script; and the home folder (Connect to a specific path)
    *Organization tab: Job title, Department, Company.

    Is this possible? And can we add the member of groups to the script?


  • #31723
    Profile photo of Chris Wolfenden
    Chris Wolfenden

    This should be very straightforward with a call to New-ADuser. Take a look at

    get-help new-aduser -online

    What type of of email system are you running?

  • #31724
    Profile photo of Matt McTaggart
    Matt McTaggart

    Exchange 2010. Please be aware that I am a beginner at PowerShell.

  • #31725
    Profile photo of Rob Simmers
    Rob Simmers

    Hey Matt,

    Definitely very possible. Remote Server Administration Tools installed (with Active Directory module for Windows Powershell enabled) will provide Active Directory cmdlets designed to do AD administrative tasks, such as your requested items. Take a look at New-ADUser, Set-ADUser and Add-ADGroupMember.

    There are also some 3rd party AD management tools from Quest (now Dell) that can be used as well. Most of the commandlets are the same (Get-ADUser is Get-QADUser), but these commands require less work for certain tasks, especially in auditing

    There is a LOT of examples of using these tools, so give them a try (preferably in a test environment) and let us know if you have any questions.

  • #31736
    Profile photo of Mark Prior
    Mark Prior

    For the below you need to download the questad software – http://ss64.com/ps/quest.html

    first line adds the Quest module to your PS window / Session

    Add-PSSnapin Quest.ActiveRoles.ADManagement
    Get-QADUser -searchroot "OU=Users,DC=global,DC=domain,DC=com" -SizeLimit 0 -Enabled -includedProperties * | select-object name, office,parentcontainer,description,email,userprincipalname,department,title,company,homedirectory | Out-GridView | out-file c:\results.csv

    this outputs to a gridview & saves a csv, replace the -searchroot "OU=.........OU=....." with your own OU structure you want to search or simply delete -searchroot "....." to search all

  • #31738
    Profile photo of Sam Bloom
    Sam Bloom

    If we are talking software, you can have a look at Adaxes: https://www.petri.com/softerra-adaxes-review-active-directory-management-automation-solution

    It allows you to automate the CSV import or create custom web forms for input of user data via AD web interface. Basically it makes user creation a single button action that is easy to setup and maintain.

  • #31739
    Profile photo of Mark Prior
    Mark Prior

    sorry bad wording by myself, QuestAd is a PS module.

    but on the software front for AD reporting i use – http://www.cjwdev.co.uk/Software/ADReportingTool/Info.html

You must be logged in to reply to this topic.