Solved

Windows 2008 R2 Enterprise AD

Posted on 2014-01-27
6
337 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

New Windows 7 Installations take days for Windows-Updates to show up and install. This can easily be fixed. I have finally decided to write an article because this seems to get asked several times a day lately. This Article and the Links apply to…
This article explains how to install and use the NTBackup utility that comes with Windows Server.
In this video, we discuss why the need for additional vertical screen space has become more important in recent years, namely, due to the transition in the marketplace of 4x3 computer screens to 16x9 and 16x10 screens (so-called widescreen format). …
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…

765 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