Author Posts

July 25, 2018 at 4:59 pm

I have a csv setup to add users to a test domain but don't know how to populate the otherMailbox attribute

$secpass = Read-Host "Password" -AsSecureString 
Import-Csv SVCAccounts.csv |
foreach {
  $name = "$($_.DisplayName)"
   
 New-ADUser -Name $name -DisplayName $($_.DisplayName) `
    -SamAccountName $($_.SamAccountName) `
    -Department $($_.Department) `
    -Description $($_.Description) `
    -EmailAddress $($_.mail) `
    -???? @{otherMailbox=$_.OtherMailbox}`
    -AccountPassword $secpass -Path "OU=_Test,OU=ServiceAccts,OU=UserAccts,DC=corp,DC=com" `
    -Enabled:$true
}

July 25, 2018 at 5:05 pm

Read the help for New-ADUser; it has a generic -OtherAttributes parameter, which you use to populate attributes that don't have their own dedicated parameters. The help (https://docs.microsoft.com/en-us/powershell/module/addsadministration/new-aduser?view=win10-ps) includes examples for using it.

July 25, 2018 at 6:46 pm

Thanks Don,

I had read that help item earlier but clearly needed to re-visit it again to get it formatted correctly, and working.

-OtherAttributes @{'otherMailbox'=$($_.OtherMailbox)} `