PowerShell Script – Add Target Address To Multiple Users

This script will show you how to add Target address to a list of users using PowerShell.

 The script will run on Windows Server 2008 R2 and above with AD tools Installed.

Before you start create a text file called users and add the users samaccountname to it like the example below:

import-module activedirectory

Get-Content C:\users.txt | % { set-aduser $_ -add @{targetAddress="smtp:$_@domain.migration"}}

 



Posted

in

by