Solved

Windows 2008 R2 Enterprise AD

Posted on 2014-01-27
6
327 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 30

Expert Comment

by:Gareth Gudger
Comment Utility
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
Comment Utility
Are you talking about
get-aduser -filter * -properties proxyaddresses|fl name,proxyaddresses
0
 

Author Comment

by:James Danahay
Comment Utility
Yes I'm trying to add the proxyaddress in the AD user proxyaddresses
0
How does your email signature look on mobiles?

Do your employees use mobile devices to reply to emails? With mobile becoming increasingly important to the business world, it is in your best interest to make sure that your email signature looks great across all types of devices.

 
LVL 4

Expert Comment

by:pcmghouse
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Scenario:  You do full backups to a internal hard drive in either product (SBS or Server 2008).  All goes well for a very long time.  One day, backups begin to fail with a message that the disk is full.  Your disk contains many, many more backups th…
When you upgrade from Windows 8 to 8.1 or to Windows 10 or if you are like me you are on the Insider Program you may find yourself with many 450MB recovery partitions.  With a traditional disk that may not be a problem but with relatively smaller SS…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now