Aller au contenu

« Active directory » : différence entre les versions

De Banane Atomic
Aucun résumé des modifications
 
Ligne 1 : Ligne 1 :
[[Category:Windows]]
[[Category:Windows]]
[[Category:CSharp]]
= [http://www.fixedbyvonnie.com/2015/04/understanding-active-directory-in-windows-server-2012-r2-part-2-of-3/#.WfxkAYgo870 Installation sur Windows Server 2012] =
= [http://www.fixedbyvonnie.com/2015/04/understanding-active-directory-in-windows-server-2012-r2-part-2-of-3/#.WfxkAYgo870 Installation sur Windows Server 2012] =
Server Manager Dashboard → Add roles and features → Role-based
Server Manager Dashboard → Add roles and features → Role-based

Dernière version du 20 février 2022 à 17:13

Installation sur Windows Server 2012

Server Manager Dashboard → Add roles and features → Role-based

  • AD Domain Services
  • AD Federation Services

Server Manager Dashboard → AD DS → more → promote this server to a domain controller

  • Add a New Forest
  • Root domain name: domain.ch
Le serveur doit avoir une IP fixe.

Scripts PowerShell

Installer Remote Server Administration Tools for Windows 10 si besoin (The specified module 'activedirectory' was not loaded)
import-module activedirectory

# Afficher toutes les propriétés des tous les comptes *NAME*
Get-ADUser -Filter {EmailAddress -like "*NAME*"} -properties *

# Afficher tous les comptes utilisateur
Get-ADUser -Filter {ObjectClass -eq "user"}

# Afficher tous les comptes utilisateur *NAME*
Get-ADObject -Filter {(mail -like "*NAME*") -and (ObjectClass -eq "user")}

Ajouter un utilisateur

  1. Server Manager → AD DS → clique-droit sur le serveur → AD Users and Computers
  2. clique-droit sur domain.ch → New → Organisational Unit
  3. clique-droit sur l'OU → New → User

ADWS

  • Endpoints par défaut: netTCP Binding sur le port 9389
  • pas de support HTTP-binding
NetTcpBinding tcpBind = new NetTcpBinding();
var acctMgmt = new ADWSSvc.AccountManagementClient(tcpBind,
    new EndpointAddress("net.tcp://localhost:9389/ActiveDirectoryWebServices/Windows/AccountManagement"));
acctMgmt.ClientCredentials.Windows.AllowedImpersonationLevel =
    System.Security.Principal.TokenImpersonationLevel.Impersonation;
var adPrincipal = acctMgmt.GetADGroupMember("ldap:389", 
                                            "CN=Domain Admins,CN=Users,DC=corp,DC=claimsauth,DC=com",
                                            "DC=corp,DC=claimsauth,DC=com", 
                                            true);
foreach (var item in adPrincipal)
{
    Console.WriteLine(item.Name);
    Console.WriteLine(item.DistinguishedName);
    Console.WriteLine(item.SamAccountName);
}

Liens

Local users and groups

using System.DirectoryServices;

var ad = new DirectoryEntry($"WinNT://{Environment.MachineName},computer");
var user = ad.Children.Find("Bibi", "user");
var adminGroup = ad.Children.Find("Administrators", "group");
adminGroup.Invoke("Add", new object[] { user.Path });  // add the user to the admin group

LDAP

User Info

Change Password

Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

Le compte qui fait tourner le service n'a pas le droit de modifier un password.
Specify an Identity for an Application Pool:

  1. IIS Manager → clique sur Application Pools
  2. clique-droit sur le site à modifier → Advanced Settings → Process Model → Identity
  3. Custom Account

AD Federated Services