Hi stefri,
> Is there any settings on IIS to be applied?
An authentication method should be applied (basic or integrated..etc) the anonymous account won't have the privilieges to access the domain ad unless it is set to be a domain account.. security risk)
read:
http://msdn.microsoft.com/
<%
sLogonUser = Request.ServerVariables("L
sDomain = Mid(sLogonUser, 1, Instr(1, sLogonUser, "\") - 1)
sLogonName = Mid(sLogonUser, Instr(1, sLogonUser, "\") + 1)
Response.Write GetUserFullName(sDomain, sLogonName)
Function GetUserFullName(sDomainNam
On Error Resume Next
Set oUser = GetObject("WinNT://" & sDomainName & "/" & sLogonName & ",user")
GetUserFullName = oUser.FullName
Set oUser = Nothing
If Err <> 0 Then
GetUserFullName = "User not found"
End If
End Function
%>
--------------------------
' get a reference to that user (it's of data type IADSUser)
Set oUser = GetObject("WinNT://" & sDomainName & "/" & sLogonName & ",user")
' now, you can access its properties:
GetUserFullName = oUser.FullName
' listing the groups the user is in:
For Each oGroup in oUser.Groups
Response.Write oGroup.Name & "<br>"
Next
--------------------------
Creating a user:
' Set up property values for the new user
sUsername = "adsitester"
sFullName = "ADSI Test Account"
sDescription = "A user account for testing ADSI"
sPassword = "passworD2"
Set myComputer = GetObject("WinNT://servern
' Create the new user account
Set newUser = myComputer.Create("user", sUsername)
' Set properties in the new user account
newUser.SetPassword sPassword
newUser.FullName = sFullName
newUser.Description = sDescription
newUser.SetInfo
--------------------------
Changing the password:
strMachine = "servername"
strUID = "username"
strPWDOld = "oldpwd"
strPWDNew = "newpwd"
Set objUser = GetObject("WinNT://" & strMachine & "/" & strUID & ",user")
objUser.ChangePassword(str
--------------------------
The ADSI Scripting Reference is here: http://msdn.microsoft.com/
Cheers!
Main Topics
Browse All Topics





by: ASPGuruPosted on 2003-07-30 at 13:22:17ID: 9039463
this may help:
/tutorials /article.p hp/1476961 .com/tutor ials/artic le.php/147 8231
http://www.serverwatch.com
http://dev-www.serverwatch
ASPGuru