Create AD users and mailboxes from .csv file

Welcome Forums General PowerShell Q&A Create AD users and mailboxes from .csv file

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
3 years, 9 months ago.

  • Author
    Posts
  • #28691

    Participant
    Topics: 32
    Replies: 40
    Points: 1
    Rank: Member

    Hi, I want to utilize the fact that New-ADUser cmdlet has parameters which accept pipeline input ByPropertyName (GivenName,SurName,SamAccountName,Title, . . .) thus I have created input .csv file with appropriate column names. The catch here is that I want to run Enable-Mailbox on newly created user account immediately after it has been created with New-ADUser cmdlet so I added another column in .csv file called MailboxDatabase where name of mailbox database is entered and used as -Database parameter in Enable-Mailbox cmdlet.

    How to perform New-ADUser and Enable-Mailbox in the most efficient way keeping in mind I want to utilize pipeline input ByPropertyName capability of New-ADUser cmdlet? Thx in advance!

  • #28692

    Participant
    Topics: 3
    Replies: 14
    Points: 1
    Rank: Member

    maybe something like

    Import-Csv -Path 'filename.csv' | new-aduser -PassThru | Enable-Mailbox

  • #28717

    Participant
    Topics: 32
    Replies: 40
    Points: 1
    Rank: Member

    I have already tried this. It does not work. I am at home now but if I remember well Enable-Mailbox complained about input object type in pipeline.

The topic ‘Create AD users and mailboxes from .csv file’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort