If you run your logon script visible, you might want to
display a previous logon message to your users, similar to:
Last logon was 03/01/2001 10:16 from computer name <Computer Name>.
To implement this display function:
1. Create a LastLogon$ share on your PDC.
2. Grant the Everyone full control on the share.
3. Set the NTFS permissions on the shared folder to:
Authenticated Users - Read + Add (write).
Creator Owner - Change.
Add the following to the end of your logon script:
@echo off call :lastLogon <\\PDCname> Goto end :LastLogon setlocal set PDCname=%1 if exist "%PDCname%\lastlogon$\%username%.lli" type "%PDCName%\lastlogon$\%username%.lli" if exist "%PDCname%\lastlogon$\%username%.lli" del /q "%PDCName%\lastlogon$\%username%.lli" For /f "Skip=19 Tokens=*" %%i in ('Net user "%username%" /domain') do call :llifind "%%i" endlocal goto end :llifind set line=%1 set line=%line:"=% if /i not "%line:~0,10%" EQU "Last logon" goto end set display=Last logon was %line:~29,20% from computer name %computername%. @echo %display%>"%PDCname%\lastlogon$\%username%.lli" :endNOTE: The first time a user logs on after you implement the script, nothing is displayed, but the the event is recored at %PDCname%\lastlogon$\%username%.lli.
NOTE: See WhereIs.
0 comments
Hide comments