Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.
January 22, 2004
Using the Active Directory command-line tools, in a Windows 2000 domain, or Windows Server 2003 domain, I have scripted SetUPN.bat to set all user UPNs.
The syntax for using SetUPN.bat is:
SetUPN domain [/R]
Where domain is the domain name to use, as in JSIINC.COM, and /R is an optional switch which causes all UPNs to be reset. When /R is omitted, only accounts without a configured UPN are updated.
SetUPN.bat contains:
@echo offif {%1}
{/r} goto setitfor /f "Tokens=*" %%u in ('dsquery user -o upn %dn%') do set oldupn=%%uif not %oldupn% EQU "" goto :EOF:setitdsmod user %dn% -upn %upn%
You May Also Like