Powershell – When do the user logon scripts run

logon-scriptspowershellwindows-server-2008-r2

I have several user logon scripts defined in active directory. These are batch scripts as well as powershell scripts.

When do these actually run? Does the user see "black terminal boxes" when he logs on, or do the scripts run while he sees the login screen?

Edit for clarification:
I am speaking of logon scripts, defined in GPO and I am running Windows Server 2008 R2.

Best Answer

Logon scripts don't display a command prompt window whilst they are running by default, however it is possible to enable this behaviour via a GPO.

The logon scripts will run whilst the explorer shell is loading.

You can test the exact timing of this by adding the following to one of your scripts, which will record the time the script is run in a log file.

echo %date% %time% > %TEMP%\logon.log