'Powershell Script to swap Proxyaddresses and PrincipalName
Been writing script:
foreach ($Username in (Import-Csv -Path "C:\Users\...\nope.csv")) {
set-aduser $Username.Username -remove @{Proxyaddresses="smtp:[email protected]"}
Write-Output "remove proxy"
set-aduser $Username.Username -replace @{userPrincipalName="[email protected]"}
Write-Output "replace principal"
set-aduser $Username.Username -add @{Proxyaddresses="smtp:[email protected]"}
Write-Output "add proxy"
}
the code runs but ends up putting this garbage -> @{Username=###}[email protected] in the attribute Editor.
Any help would be appreciated, been trying different ways for like 8h now.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
