This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
2
modify proxyaddresses without set-aduser/rsat
Post Flair (click to view more posts with a particular flair)
Post Body
i can easily make the changes i need with this
Set-ADUser -Identity $sam -Add @{ProxyAddresses = $proxyaddresses} -Server $servername
however, i like to have the option of a way to do this without RSAT in case I'm on a computer without it installed.
i have seen plenty of times that people use this:
https://www.reddit.com/r/PowerShell/comments/2jiqcj/script_for_adding_proxyaddresses_to_accounts/
# https://docs.microsoft.com/en-us/previous-versions/tn-archive/ee156515(v=technet.10)
# https://docs.microsoft.com/en-us/windows/desktop/adsi/the-putex-method
[int] $ADS_PROPERTY_CLEAR = 1
[int] $ADS_PROPERTY_UPDATE = 2
[int] $ADS_PROPERTY_APPEND = 3
[int] $ADS_PROPERTY_DELETE = 4
# Derive user DN in whatever method you prefer
# Delete, Append, Update - Take your pick
$ADuser = [ADSI]"LDAP://Contoso-DC-08/$($userAccount.DistinguishedName)"
$ADuser.PutEx($ADS_PROPERTY_DELETE, "proxyAddresses", @("smtp:[email protected]"))
$ADuser.PutEx($ADS_PROPERTY_APPEND, "proxyAddresses", @("SMTP:[email protected]"))
# Commit changes to AD User Object
$ADuser.SetInfo()
but no matter which way i do it, i just end up with this!
Exception calling "PutEx" with "3" argument(s): "Unspecified error
"
At C:\path\to\script.ps1:214 char:1
$ADuser.PutEx($ADS_PROPERTY_APPEND, "proxyAddresses", @($proxyaddress ...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : CatchFromBaseAdapterMethodInvokeTI
and i can't for the life of me figure out why... Q_Q
any help would be greatly appreciated
Author
Account Strength
100%
Account Age
9 years
Verified Email
Yes
Verified Flair
No
Total Karma
5,433
Link Karma
847
Comment Karma
4,390
Profile updated: 5 days ago
Posts updated: 8 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 6 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PowerShell/...