Solved

Windows 2008 R2 Enterprise AD

Posted on 2014-01-27
6
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

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

Know what services you can and cannot, should and should not combine on your server.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
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…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

695 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