adding proxyAddresses to AD users

so i have a bulk import script, works fine. i can add fields to it and such, does what i want it to… so now i have to add an additional field and i cannot figure out what im supposed to call it.

it looks like this:

Import Modules

Import-Module ActiveDirectory

Set a password

$securePassword = ConvertTo-SecureString “removed” -AsPlainText -Force

Prompt for CSV path

$filepath = Read-Host -Prompt “Enter CSV path”

Import The file into varibles…

$users = Import-Csv $filepath

loop and gather data

ForEach ($user in $users) {

#Gather user info $fname = $user.'First Name' $lname = $user.'Last Name' $dname = $user.DisplayName $name = $user.Name $sam = $user.SAM $OU = $user.OU $email = $user.Email $logon = $user.SAM $description = $user.Description #create new AD user for each item in CSV New-ADUser -Name "$fname $lname" -GivenName $fname -Surname $lname -UserPrincipalName "$sam" -Path $OU -EmailAddress $email -Description $description -Enabled $true -AccountPassword $SecurePassword 

so i have another field in the CSV for proxyAddress. i tried adding: $proxyad = $user.proxyAddress

and then in the last line i tried to add: New-ADUser -Name “$fname $lname” -GivenName $fname -proxyAddress $proxyad

but its not recognizing the proxyAddress field. so what do i have to call the field to get it to put the address in the proxyAddresses field in AD?

thanks in advance, i know this is pretty simple, i just dont know what its supposed to be called. it works perfectly without the proxy address part, but now i need an additional address in the field. the accounts are not in use right this second, so i can either update the existing users or create new…

submitted by /u/jimmy_poodoo
[link] [comments]

Leave a Reply