Display instructions in logon scripts as they run
Afficher les instructions des scripts d’ouverture de session pendant leur exécution
Explanation
This policy setting displays the instructions in logon scripts as they run.
Logon scripts are batch files of instructions that run when the user logs on. By default, the system does not display the instructions in logon scripts.
If you enable this policy setting, the system displays each instruction in the logon script as it runs. The instructions appear in a command window. This policy setting is designed for advanced users.
If you disable or do not configure this policy setting, the instructions are suppressed.
Ce paramètre de stratégie affiche les instructions des scripts d’ouverture de session lors de leur exécution.
Les scripts d’ouverture de session sont des fichiers de commandes comprenant des instructions qui sont exécutées chaque fois que l’utilisateur ouvre une session. Par défaut, le système n’affiche pas les instructions des script d’ouverture de session.
Si vous activez ce paramètre de stratégie, le système affiche chaque instruction du script d’ouverture de session pendant son exécution. Les instructions apparaissent dans une fenêtre de commandes. Ce paramètre de stratégie est destiné aux utilisateurs expérimentés.
Si vous désactivez ce paramètre de stratégie ou ne le configurez pas, les instructions sont supprimées.
Registry
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System- Value name
HideLogonScripts
| State | Value written |
|---|---|
| Enabled | REG_DWORD = 0 |
| Disabled | REG_DWORD = 1 |
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.
Enable
# Enable: Scripts/Run_Logon_Script_Visible
$k = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'HideLogonScripts' -Value 0 -Type DWordDisable
# Disable: Scripts/Run_Logon_Script_Visible
$k = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'HideLogonScripts' -Value 1 -Type DWordRevert to "Not configured"
# Revert to "Not configured": Scripts/Run_Logon_Script_Visible
$k = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies\System'
Remove-ItemProperty -Path $k -Name 'HideLogonScripts' -ErrorAction SilentlyContinue