/ Forside / Teknologi / Udvikling / VB/Basic / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
VB/Basic
#NavnPoint
berpox 2425
pete 1435
CADmageren 1251
gibson 1230
Phylock 887
gandalf 836
AntonV 790
strarup 750
Benjamin... 700
10  tom.kise 610
[VB6] IIS4
Fra : Niels Henriksen


Dato : 19-02-01 23:53

Jeg skal lave en rutine der kan arbejde med IIS4. Det skal kunne oprette
domæner med dertilhørende tingeltangel. Der skal desuden kunne oprettes en
bruger på serveren samt sættes rettigheder til denne.

Håber nogle kan være behjælpelig med URL eller evt kode


--
Niels Henriksen
Systemudvikler
Netopcom Danmark ApS
www.netopcomdanmark.dk



 
 
Jan Damkjær Dahl (20-02-2001)
Kommentar
Fra : Jan Damkjær Dahl


Dato : 20-02-01 19:37

Prøv at kigge på ADSI

her har du lidt kode

Querying the User FullName Property Using a VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Response.Write User.Fullname


Setting a New Value for the User FullName Property Using a VBScript Active
Server Page

Dim User
Dim UserName
Dim UserDomain
Dim NewFullName
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
NewFullName = "New_Value_For_Full_Name_Field"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
User.Fullname = NewFullname
User.SetInfo


Querying the Description Property Using a VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Response.Write User.Description


Setting a New Value for the Description Property Using a VBScript Active
Server Page

Dim User
Dim UserName
Dim UserDomain
Dim NewDescription
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
NewDescription = "New_Value_For_Description_Field"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
User.Description = NewDescription
User.SetInfo


Querying Individual Elements of a Comma Delimited Description Field Using a
VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
Dim Delimiter
Dim RetVal
Dim FirstDelim
Dim DescriptionLength
Dim ParsedElement
Dim TerminalCondition
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Delimiter = "|"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
RetVal = User.Description
StartPosition = 1
While TerminalCondition <> True
FirstDelim = InStr(1, RetVal, Delimiter)
If FirstDelim = 0 Then
TerminalCondition = True
Else
DescriptionLength = Len(RetVal)
ParsedElement = Left(RetVal, FirstDelim - 1)
Response.Write Trim(ParsedElement)
RetVal = Right(RetVal, (DescriptionLength - FirstDelim))
End If
Wend


Setting a New Value for a User Password Using a VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
Dim NewPassword
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
NewPassword = "Superm@n99"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Call User.SetPassword(NewPassword)
User.SetInfo


Changing a User Password Using a VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
Dim NewPassword
Dim OldPassword
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
NewPassword = "Superm@n26"
OldPassword = "B@tm@n74!"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Call User.ChangePassword(OldPassword, NewPassword)
User.SetInfo


Querying the Value of a User Flag Using a VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
Dim Flags
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Flags = User.Get("UserFlags")
If (Flags And &H10000) <> 0 Then
Response.Write "The specified user account is configured so that the
password never expires."
End If


Toggling User Flags Using a VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
Dim Flags
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Flags = User.Get("UserFlags")
User.Put "UserFlags", (Flags Xor &H10000)
User.SetInfo


Querying the User Must Change Password at Next Logon Status Flag Using a
VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
Dim PasswordExpired
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
PasswordExpired= User.Get("PasswordExpired")
If PasswordExpired = 1 Then
Response.Write "The user account is configured so that the password must
be changed on next logon."
Else
Response.Write "The user will NOT be required to change the account
password on next logon."
End If


Setting a New Value for the User Must Change Password at Next Logon Status
Flag Using a VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
Dim PasswordExpired
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
User.Put "PasswordExpired", 1
User.SetInfo


Querying the User Cannot Change Password Status Flag Using a VBScript Active
Server Page

Dim User
Dim UserName
Dim UserDomain
Dim Flags
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Flags = User.Get("UserFlags")
If (Flags And &H00040) <> 0 Then
Response.Write "The specified user account is configured so that the
password cannot be changed."
End If


Explicitly Setting the Value for the User Cannot Change Password Status Flag
Using a VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
Dim Flags
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Flags = User.Get("UserFlags")
User.Put "UserFlags", Flags OR &H00040
User.SetInfo


Toggling the Value for the User Cannot Change Password Status Flag Using a
VBScript Active Server Page

Dim User
Dim UserName
Dim UserDomain
Dim Flags
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Flags = User.Get("UserFlags")
User.Put "UserFlags", Flags XOR &H00040
User.SetInfo


Querying the Password Never Expires Status Flag Using a VBScript Active
Server Page

Dim User
Dim UserName
Dim UserDomain
Dim Flags
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Flags = User.Get("UserFlags")
If (Flags And &H10000) <> 0 Then
Response.Write "The specified user account is configured so that the
password never expires."
End If


Explicitly Setting the Password Never Expires Status Flag Using a VBScript
Active Server Page

Dim User
Dim UserName
Dim UserDomain
Dim Flags
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Flags = User.Get("UserFlags")
User.Put "UserFlags", Flags OR &H10000
User.SetInfo


Toggling the Password Never Expires Status Flag Using a VBScript Active
Server Page

Dim User
Dim UserName
Dim UserDomain
Dim Flags
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Flags = User.Get("UserFlags")
User.Put "UserFlags", Flags XOR &H10000
User.SetInfo


Querying the Account Disabled Status Flag Using a VBScript Active Server
Page

Dim User
Dim UserName
Dim UserDomain
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
Response.Write User.AccountDisabled


Setting a New Value for the Account Disabled Status Flag Using a VBScript
Active Server Page

Dim User
Dim UserName
Dim UserDomain
UserDomain = "Target_User_Domain"
UserName = "Target_User_Name"
Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user")
User.AccountDisabled = True
User.SetInfo


"Niels Henriksen" <niels@ryttersnak.dk> skrev i en meddelelse
news:96s7r5$22f2$1@news.cybercity.dk...
> Jeg skal lave en rutine der kan arbejde med IIS4. Det skal kunne oprette
> domæner med dertilhørende tingeltangel. Der skal desuden kunne oprettes en
> bruger på serveren samt sættes rettigheder til denne.
>
> Håber nogle kan være behjælpelig med URL eller evt kode
>
>
> --
> Niels Henriksen
> Systemudvikler
> Netopcom Danmark ApS
> www.netopcomdanmark.dk
>
>



Søg
Reklame
Statistik
Spørgsmål : 177558
Tips : 31968
Nyheder : 719565
Indlæg : 6408929
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste