Configurer la gestion automatique des comptes
Configure automatic account management
Explication
Cette stratégie configure les options de stratégie de gestion automatique des comptes.
Spécifiez le compte cible à gérer : spécifie si le compte d’administrateur intégré ou un compte personnalisé doit être géré.
Nom du compte automatique (ou préfixe de nom) : spécifie le nom, ou le préfixe de nom, à utiliser pour le compte géré.
Si ce paramètre de stratégie est configuré, Windows LAPS l'utilisera comme nom de compte ou préfixe de nom pour le compte cible.
Si ce paramètre de stratégie n’est pas configuré, Windows LAPS utilise « WLapsAdmin » comme préfixe de nom ou de nom de compte.
Remarque : ce nom est traité comme un préfixe lorsque le choix au hasard des noms de comptes est configurée, voir les commentaires ci-dessous.
Activer le compte géré : spécifie si le compte géré doit être activé ou non.
Si ce paramètre de stratégie est configuré, Windows LAPS active le compte géré spécifié.
Si ce paramètre de stratégie n’est pas configuré, Windows LAPS désactive le compte géré spécifié.
Remarque : Windows LAPS maintient et renouvelle régulièrement le code d'accès du compte géré, que le compte soit maintenu dans un état activé ou désactivé.
Choisir au hasard le nom du compte géré : spécifie si le nom du compte géré doit être choisi au hasard avec un suffixe numérique aléatoire.
Si ce paramètre de stratégie est configuré, Windows LAPS ajoute un suffixe numérique aléatoire à huit chiffres au nom du compte automatique managé et rend aléatoire à nouveau le nom du compte géré chaque fois que le code d'accès est renouvelé.
Si ce paramètre de stratégie n’est pas configuré, Windows LAPS utilise le nom du compte automatique géré tel qu'il a été configuré.
Si le préfixe du nom du compte automatique géré est configuré, Windows LAPS utilise jusqu'aux douze (12) premiers caractères de ce nom comme préfixe pour le nom aléatoire. Si ce paramètre de stratégie n’est pas configuré, Windows LAPS utilise « WLapsAdmin » comme préfixe de nom.
Remarque : le compte DSRM sur les contrôleurs de domaine ne peut pas être configuré pour la gestion automatique des comptes. Cette stratégie n’a aucun effet sur les contrôleurs de domaine et sera ignorée même si elle est configurée pour un contrôleur de domaine.
Voir « https://go.microsoft.com/fwlink/?linkid=2188435 » pour plus d'informations.
This policy configures automatic account management policy options.
Specify the target account to manage: specifies whether the built-in admin account or a custom account should be managed.
Automatic account name (or name prefix): specifies the name, or name prefix, to use for the managed account.
If this policy setting is configured, Windows LAPS will use it as the account name or name prefix for the target account.
If this policy setting is not configured, Windows LAPS will use "WLapsAdmin" as the account name or name prefix.
Note: this name is treated as a prefix when account name randomization is configured, see comments below.
Enable the managed account: specifies whether the managed account should be enabled or not.
If this policy setting is configured, Windows LAPS will enable the specified managed account.
If this policy setting is not configured, Windows LAPS will disable the specified managed account.
Note: Windows LAPS will regularly maintain and rotate the password of the managed account regardless of whether the account is maintained in an enabled\disabled status.
Randomize the name of the managed account: specifies whether the name of the managed account should be randomized with a random numeric suffix.
If this policy setting is configured, Windows LAPS will add an eight digit random numeric suffix to the managed automatic account name, and will re-randomize the name of the managed account every time the password is rotated.
If this policy setting is not configured, Windows LAPS will use the managed automatic account name as configured.
If the managed automatic account name prefix is configured, Windows LAPS will use up to the first twelve (12) characters of that name as a prefix for the random name. If the managed automatic account name is not configured, Windows LAPS will use "WLapsAdmin" as the name prefix.
Note: the DSRM account on domain controllers cannot be configured for automatic account management. This policy has no effect on domain controllers and will be ignored even if configured for a DC.
See https://go.microsoft.com/fwlink/?linkid=2188435 for more information.
Cas d'usage
Permet à Windows LAPS de créer et gérer lui-même un compte administrateur local dédié (nommé WLapsAdmin par défaut, avec option de nom aléatoire), sans script de provisionnement. C’est pratique pour désactiver le compte administrateur intégré tout en gardant un accès de dépannage.
Réservé à Windows 11 24H2 et Windows Server 2025 ; le compte est créé désactivé par défaut, il faut donc activer l’option correspondante pour pouvoir s’en servir.
Sources Microsoft : Configure policy settings for Windows LAPS · Windows LAPS overview
Registre
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\LAPS- Nom de la valeur
AutomaticAccountManagementEnabled
| État | Valeur écrite |
|---|---|
| Activé | REG_DWORD = 1 |
| Désactivé | REG_DWORD = 0 |
PowerShell
Commandes PowerShell qui écrivent dans le registre ce que la stratégie écrirait. Les valeurs entre chevrons (<…>) sont à remplacer.
Écrire directement dans le registre contourne la stratégie de groupe : si une GPO gère cette valeur, elle sera réécrite au prochain gpupdate ; sinon la valeur reste en place (effet « tatouage »). Préférez une GPO ou, en local, LGPO.exe. Exécutez PowerShell en administrateur pour HKLM. Certaines stratégies demandent un redémarrage ou gpupdate /force.
Activer
# Activer : LAPS/LAPS_AutomaticAccountManagementPolicy
$k = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\LAPS'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'AutomaticAccountManagementEnabled' -Value 1 -Type DWord
# Spécifiez le compte cible à gérer
# Options possibles :
# Manage the built-in admin account = 0
# Manage a custom admin account = 1
Set-ItemProperty -Path $k -Name 'AutomaticAccountManagementTarget' -Value 0 -Type DWord
# Nom du compte automatique (ou préfixe du nom)
Set-ItemProperty -Path $k -Name 'AutomaticAccountManagementNameOrPrefix' -Value '<valeur>' -Type String
# Activer le compte géré
# valeur non définie dans l'ADMX (l'éditeur GPO écrit en général 1/0)
# 1 = coché, 0 = décoché ; état par défaut de la case repris de l’ADML
Set-ItemProperty -Path $k -Name 'AutomaticAccountManagementEnableAccount' -Value 1 -Type DWord
# Choisir au hasard le nom du compte géré
Set-ItemProperty -Path $k -Name 'AutomaticAccountManagementRandomizeName' -Value 1 -Type DWord # valeur non définie dans l'ADMX ; 1 = coché, 0 = décochéDésactiver
# Désactiver : LAPS/LAPS_AutomaticAccountManagementPolicy
$k = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\LAPS'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'AutomaticAccountManagementEnabled' -Value 0 -Type DWordRevenir à « Non configuré »
# Revenir à « Non configuré » : LAPS/LAPS_AutomaticAccountManagementPolicy
$k = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\LAPS'
Remove-ItemProperty -Path $k -Name 'AutomaticAccountManagementEnabled' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'AutomaticAccountManagementTarget' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'AutomaticAccountManagementNameOrPrefix' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'AutomaticAccountManagementEnableAccount' -ErrorAction SilentlyContinue
Remove-ItemProperty -Path $k -Name 'AutomaticAccountManagementRandomizeName' -ErrorAction SilentlyContinueOptions (4)
| Libellé | Contrôle | Valeur de registre | Type REG | Contraintes / détails | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Spécifiez le compte cible à gérer :Specify the target account to manage:LAPS_AutomaticAccountManagementTarget | Liste déroulanteenum | AutomaticAccountManagementTarget | REG_DWORD | Choix par défaut (interface) : n° 0
| ||||||
| Nom du compte automatique (ou préfixe du nom) :Automatic account name (or name prefix):LAPS_AutomaticAccountManagementNameOrPrefix | Zone de textetext | AutomaticAccountManagementNameOrPrefix | REG_SZ | Longueur max : 20 | ||||||
| Activer le compte géréEnable the managed accountLAPS_AutomaticAccountManagementEnableAccount | Case à cocherboolean | AutomaticAccountManagementEnableAccount | REG_DWORD | Coché : implicite : 1Décoché : implicite : 0 | ||||||
| Choisir au hasard le nom du compte géréRandomize the name of the managed accountLAPS_AutomaticAccountManagementRandomizeName | Case à cocherboolean | AutomaticAccountManagementRandomizeName | REG_DWORD | Coché : implicite : 1Décoché : implicite : 0 |