Solved

Windows 2008 R2 Enterprise AD

Posted on 2014-01-27
6
339 Views
Last Modified: 2014-03-03
I have a windows 2008 R2 enterprise server as a DC. I need to modify the proxy address in the attribute editor for 1000 AD accounts. I would like to do this via a script as a bulk import.

Any ideas
0
Comment
Question by:James Danahay
  • 3
  • 2
6 Comments
 
LVL 31

Expert Comment

by:Gareth Gudger
ID: 39814190
Are you referring to a Proxy Address in Internet Explorer? If so, you can use Group Policy Management Console to create a group policy for this change. Then just apply that policy to the OU where these AD accounts are located.
0
 
LVL 4

Expert Comment

by:pcmghouse
ID: 39814824
Are you talking about
get-aduser -filter * -properties proxyaddresses|fl name,proxyaddresses
0
 

Author Comment

by:James Danahay
ID: 39816636
Yes I'm trying to add the proxyaddress in the AD user proxyaddresses
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 4

Expert Comment

by:pcmghouse
ID: 39817000
import-module activedirectory
get-aduser testuser -properties proxyaddresses|fl name,proxyaddresses|out-file -append c:\temp\oldproxyaddresses.txt
$addproxyaddress="smtp:testuser2@contoso.com"
set-aduser testuser -add @{proxyaddresses=$addproxyaddress}
get-aduser testuser -properties proxyaddresses|fl name,proxyaddresses|out-file -append c:\temp\newproxyaddresses.txt

The above powershell code has 5 lines. Replace testuser with one of your users and test it. You need domain admin privileges.

Once you are comfortable with the above code, you can loop thru each user. Also we may need to modify the $addproxyaddress as each user may have a different one.
0
 

Author Comment

by:James Danahay
ID: 39828257
Great code - works well

How do I loop through each user as I have about 800 users?
0
 
LVL 4

Accepted Solution

by:
pcmghouse earned 500 total points
ID: 39828776
import-module activedirectory
$users = Get-ADUser -filter * -properties proxyaddresses
Foreach ($user in $users)
{
"Proxyaddresses: " + $user.proxyaddresses | out-file -append c:\temp\oldproxyaddresses.txt
"DN: " + $user.distinguishedname | out-file -append c:\temp\oldproxyaddresses.txt
"==================================================================" | out-file -append c:\temp\oldproxyaddresses.txt
$addproxyaddress = "smtp:" + $user.samaccountname + "2@contoso.com"
set-aduser -identity $user.samaccountname -add @{proxyaddresses=$addproxyaddress}
}

Testing:
The above code should help you. Test it before using it.
Modify the first line like this to test:
$users = Get-ADUser -filter {samaccountname -like "*jdanahay*"} -properties proxyaddresses

You can comment the set-aduser line and check the log file to see the list of users that will be modified. Put a hash like this:
#set-aduser -identity $user.samaccountname -add @{proxyaddresses=$addproxyaddress}
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
Know what services you can and cannot, should and should not combine on your server.
This tutorial will walk an individual through locating and launching the BEUtility application and how to execute it on the appropriate database. Log onto the server running the Backup Exec database. In a larger environment, this would generally be …
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question