Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[C#/LDAP] - Terminalserverprofilpfad im AD ändern

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich versuche gerade Programmgesteuert den Terminalserverprofilpfad eines

Benutzers im AD zu ändern.

Das klappt aber seltsamerweise nicht wie mit allen anderen Attributen.

Weiß jemand woran es liegt? Habs auch schon mit anderen Herangehensweisen versucht, aber die geben die gleiche Warnmeldung.

Der Benutzer auf den ich es angewandt habe,

ist ein Terminalservernutzer, er hat also auch die Berechtigungen sich am TS anzumelden etc.



Der Index lag außerhalb des Bereichs. Er muss nicht negativ und kleiner als die Auflistung sein.

Parametername: index


//rename user

        private static void RenameUserinAD(string UserDN, string newUserName, string Domain, string profilepath, string homedirpath, string tprofile)

        {




            System.DirectoryServices.DirectoryEntry user =

            new System.DirectoryServices.DirectoryEntry("LDAP://" + UserDN + "");

            //accoutname

            user.Properties["userPrincipalName"][0] = newUserName + "@" + Domain;

            //accountname pre2000

            user.Properties["samAccountName"][0] = newUserName;

            //profile

            user.Properties["profilePath"][0] = ""+profilepath + newUserName+"";

            //homedir

            user.Properties["homeDirectory"][0] = ""+homedirpath + newUserName+"";

user.Properties["TerminalServicesProfilePath"][0] = ""+tprofile + newUserName+"";

            user.CommitChanges();

            user.Close();



        }

  • Autor

Editieren war leider nicht möglich.

Die TerminalServicesProfile Attribute scheinen keine normalen AD Attribute zu sein, sehe ich das richtig?

Falls es zur Problemlösung hilft:

Wir benutzen Citrix und Windows Server 2003.

  • 1 Monat später...
  • Autor

Falls mal jemand vor dem gleichen problem steht. ;)

Einfach die Dll "Interop.TSUSEREXLib" registrieren und dann kann man mit folgendem Code die TerminalService Attribute ändern:


DirectoryEntry ent = new DirectoryEntry("LDAP://" + UserDn);
IADsTSUserEx TSUser = (IADsTSUserEx)ent.NativeObject;
TSUser.TerminalServicesProfilePath = "abc";
ent.CommitChanges();
[/PHP]

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.