Author Posts

August 18, 2015 at 3:16 am

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!

August 18, 2015 at 3:51 am

maybe something like

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

August 18, 2015 at 9:01 am

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.