Det vil sige du skal nok ha installeret noget adsi på den maskine filerne skal køres fra for det kan lade sig gøre tror jeg.....
Og det ser ummiddelbart ud til at ADSI er på domain niveau.......sorry......var nok lige en tand for hurtig tror jeg.....men koden kommer alligevel....det kan jo være der er et klogt hovede der kan stykke noget sammen :)
'Dimensioning variables and objects
'Remember to use the Reference : Active DS Type Library
Option Explicit
Dim dso As IADsOpenDSObject
Dim domain As IADsDomain
Dim vUser As String
Dim vPass As String
Dim vDomain As String
'This button ends the application
Private Sub cmdClose_Click()
Unload Me
End
End Sub
'This button logs you on the domain
Private Sub cmdVerify_Click()
'If there is an error the errorhandler catches it
On Local Error GoTo ErrorHandler
'The text fileds where you enter your info
vUser = txtUser.Text
vPass = txtPass.Text
vDomain = txtDomain.Text
'Tells that it is a WinNT domain
Set dso = GetObject("WinNT:")
'Gets the variables into the ADSI and contacts the Domain Controler
Set domain = dso.OpenDSObject("
WinNT://" & vDomain & "", "" & vUser & "", "" & vPass & "", ADS_SECURE_AUTHENTICATION)
Exit Sub
'The errorhandler catches an error and tells the user what the error is
ErrorHandler:
If Err = -2147023570 Then MsgBox "Unknown User or Bad Password", , "Login Failure"
If Err = -2147467259 Then MsgBox "Unknown Domain", , "Login Failure"
Exit Sub
End Sub
'When a field gets focus with all text is marked
Private Sub txtUser_GotFocus()
txtUser.SelStart = 0
txtUser.SelLength = Len(txtUser.Text)
End Sub
'When a field gets focus with all text is marked
Private Sub txtPass_GotFocus()
txtPass.SelStart = 0
txtPass.SelLength = Len(txtPass.Text)
End Sub
'When a field gets focus with all text is marked
Private Sub txtDomain_GotFocus()
txtDomain.SelStart = 0
txtDomain.SelLength = Len(txtDomain.Text)
End Sub