Managing Active Directory ProxyAddresses in PowerShell

Today, I introuduce how to set or manage ActiveDirectory ProxyAddresses using PowerShell not ADSI Edit tool. Before this job, I am ususally using ADSI Edit tool, if I just set that value some users, it is ok, but sometimes if we create bulk users more than 10 people, it’s burden to using ADSI Edit tool, also if you have any experience to using that tool, it’s hard to use it to find members which I set values.

So as to set that values using powershell, I have studied and searched from internet a lot.Strangely it takes time a lot to find that solution

Import-Module ActiveDirectory #importing active directory powershell module

$csvFilePath = “C:\NewUsers.csv”

Import-Csv -path $csvFilePath | ForEach {    #get values from csv using ForEach ,

        $SAM = $_.SamAccountName   #SamAccountName as field name of csv file   
        $UPN = $_.UserPrincipalName  #UserPrincipalName as field name of csv file
        $proc = “SMTP:”+ $UPN                  
#Adding proxyAddress to user , if you remove that value you use remove instead of Add properties
        Set-ADUser -Identity $SAM  -Add @{ProxyAddresses =  $proc }
        Get-ADUser -Identity $SAM -Properties ProxyAddresses | Select-Object Name,ProxyAddresses
}

Have a great day and thank you for reading my blog post.

Advertisements

글쓴이: hongwoo jin

I'm managing our Korea company's Office 365 administrator I want to be MS Office 365 & SharePoint MVP with certification.

답글 남기기

아래 항목을 채우거나 오른쪽 아이콘 중 하나를 클릭하여 로그 인 하세요:

WordPress.com 로고

WordPress.com의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Twitter 사진

Twitter의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Facebook 사진

Facebook의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

Google+ photo

Google+의 계정을 사용하여 댓글을 남깁니다. 로그아웃 / 변경 )

%s에 연결하는 중