Here is the code:
$=RedirectOutput("C:\LOGS\Logon.txt",1)
'KiX version : ' + @KiX ?
'Script dir : ' + @ScriptDir ?
'Logon server: ' + @LServer ?
'Logon drive : ' + @Ldrive ?
'Trm session : ' + @TsSession ?
'Logon mode : ' + @LogonMode ?
'Error code : ' + @ERROR + ' - ' + @SERROR ?

And here is the output (after logon)
KiX version : 4.51
Script dir : \\ITS\NETLOGON
Logon server: \\ITS
Logon drive : \\ITS\NETLOGON\
Trm session : 1
Logon mode :
Error code : 0 - The operation completed successfully.