This is a multi-part message in MIME format.
------=_NextPart_000_0055_01C3B99C.D1393590
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Can someone tell me how the code would look to change the UserID in =
Active Directory from say lastname to firstinitiallastname.
For instance: the code in RED below. Instead of echoing the value I =
want to change it.
Set objSysInfo =3D CreateObject ("ADSYstemInfo")
Set objUser =3D GetObject("LDAP://" & objSysInfo.UserName)
objUser.GetInfo
'Set objDomain =3D GetObject("LDAP://" & objSysInfo.DomainDNSName)
'objDomain.GetInfo
strDisplayName =3D objUser.Get("displayName")
strDescription =3D objUser.Get("description")
strUserName =3D objUser.Get("cn")
strUserOu =3D objUser.Get("DistinguishedName")
strUserPrincipalName =3D objUser.Get("UserPrincipalname")
strUserLastName =3D objUser.Get("sn")
strUserFirstName =3D objUser.Get("givenName")
strUserEmail =3D objUser.Get("mail")
'WScript.Echo strUsername
'WScript.Echo strDnsDomainName
'WScript.Echo strDomainShortName
'WScript.Echo strDisplayName
'WScript.Echo strDescription
WScript.Echo "User Logon ID:..............................." & =
strUserName & vbCrLf & _
"User Principal Name:........................." & strUserPrincipalName & =
vbCrLf & _
"User Full Name:..............................." & strUserLastName & ", =
" & strUserFirstName & vbCrLf & _
"Users Email Address:........................." & strUserEmail & vbCrLf =
& _
"User Account in OU:........................." & strUserOu & vbCrLf & _
"User Site:......................................" & objSysInfo.SiteName =
& vbCrLf & _
"User Description.............................." & strDescription & =
vbCrLf & _
"Current Logon DNS Domain Name:........" & objSysInfo.DomainDnsName & =
vbCrLf & _
"Current Logon NetBIOS Domain Name:..." & objSysInfo.DomainShortName
------=_NextPart_000_0055_01C3B99C.D1393590
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2800.1264" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Can someone tell me how the code =
would look to=20
change the UserID in Active Directory from say lastname to=20
firstinitiallastname.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>For instance: the code in RED =
below. Instead=20
of echoing the value I want to change it.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Set objSysInfo =3D CreateObject=20
("ADSYstemInfo")</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>Set objUser =3D GetObject("LDAP://" =
&=20
objSysInfo.UserName)<BR>objUser.GetInfo</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>'Set objDomain =3D GetObject("LDAP://" =
&=20
objSysInfo.DomainDNSName)<BR>'objDomain.GetInfo</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>strDisplayName =3D=20
objUser.Get("displayName")<BR>strDescription =3D=20
objUser.Get("description")<BR>strUserName =3D =
objUser.Get("cn")<BR>strUserOu =3D=20
objUser.Get("DistinguishedName")<BR>strUserPrincipalName =3D=20
objUser.Get("UserPrincipalname")<BR>strUserLastName =3D=20
objUser.Get("sn")<BR>strUserFirstName =3D =
objUser.Get("givenName")<BR>strUserEmail=20
=3D objUser.Get("mail")</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><BR><FONT face=3DArial size=3D2><STRONG><FONT =
color=3D#ff0000>'WScript.Echo=20
strUsername<BR></FONT></STRONG>'WScript.Echo =
strDnsDomainName<BR>'WScript.Echo=20
strDomainShortName<BR>'WScript.Echo strDisplayName<BR>'WScript.Echo=20
strDescription</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><BR><FONT face=3DArial size=3D2>WScript.Echo "User Logon=20
ID:..............................." & strUserName & vbCrLf & =
_<BR>"User Principal Name:........................." & =
strUserPrincipalName=20
& vbCrLf & _<BR>"User Full Name:..............................." =
&=20
strUserLastName & ", " & strUserFirstName & vbCrLf & =
_<BR>"Users=20
Email Address:........................." & strUserEmail & vbCrLf =
&=20
_<BR>"User Account in OU:........................." & strUserOu =
& vbCrLf=20
& _<BR>"User Site:......................................" &=20
objSysInfo.SiteName & vbCrLf & _<BR>"User=20
Description.............................." & strDescription & =
vbCrLf=20
& _<BR>"Current Logon DNS Domain Name:........" &=20
objSysInfo.DomainDnsName & vbCrLf & _<BR>"Current Logon NetBIOS =
Domain=20
Name:..." & objSysInfo.DomainShortName</FONT></DIV></BODY></HTML>
------=_NextPart_000_0055_01C3B99C.D1393590--