Autor Beitrag
kostonstyle
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Mo 25.01.10 10:32 
hallo zusammen
momentan versuche ich ein Programm zu entwickeln mit Domain Admin login. Der Ablauf sieht so aus,
der Benutzer öffnet das Programm, dann wird er aufgefordert, Domain Admin User und Passwort einzugeben.
War die Authentifizierung erfolgreich, wird ein zweites Fenter geöffnet, das Fenster wird aber als Domain Admin
ausgeführt, vergleichbar, wenn man ein Programm "Ausführen als..." ausführt.
Meine Frage, wie bringe ich so etwas fertig, bietet .NET eine Klasse, um mit Active Directory zu arbeiten?

Gruss kostonstyle
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 25.01.10 12:44 
Das funktioniert zumindest über direkte Nutzung der Windows API mit LogonUser und den entsprechenden Funktionen.

In jedem Fall brauchst du aber einen zweiten Prozess, egal ob eine Instanz der eigenen Exe oder eine neue Exe oder ein COM Objekt (Stichwort Vista Elevation). Denn es ist nicht möglich die Rechte des eigenen Prozesses zu erhöhen.
kostonstyle Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Mo 25.01.10 13:01 
könntest du bitte ein beispiel zeigen, wie ich LogonUser benutze?
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 25.01.10 13:08 
Ich habe gerade ein Beispiel für C# gefunden, ob das auch für WPF so funktioniert weiß ich nicht, da ich damit wenig Erfahrung habe:
www.codeproject.com/...pimpersonation1.aspx
kostonstyle Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Mo 25.01.10 14:03 
habe noch etwas gefunden im netz, .NET bietet eine Klasse DirectoryEntry() zum arbeiten mit Active Directory
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
DirectoryEntry login = new DirectoryEntry();
            login.Path = "LDAP://xxx.xx.xx.xx/CN=Users;DC=xxxxxxxx.xx";
            login.Username = @"domain.xxx\username";
            login.Password = "xxxxxxxxxxxx";
            login.AuthenticationType = AuthenticationTypes.Secure;
            try
            {
                Console.WriteLine(login.Name);
            }
            catch (DirectoryServicesCOMException ex)
            {
                Console.WriteLine(ex.Message);
            }
kostonstyle Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 94



BeitragVerfasst: Mo 25.01.10 14:09 
Habt ihr villeicht ein kleines Beispiel mit Login user?