Log question

G

Guest

is there a way to know how many users are logging on to our Terminal Server box? i need monthly stats for terminal service activity.
i was told to add the following line to our logon script

echo %username% %clientname% %date% %time% >> logon.log

i'm hesitant to add this to our default.bat script since i do not want to log ALL activity, only logons occuring on the TS box.

HELP!!

thanks
 
V

Vera Noest [MVP]

Sorry, I should have explained more clearly.
I meant: add this line to your TS-specific login script.

If you don't have one, then you can add this line to the login
script that is automatically run for every user of a terminal
server:
C:\WinNT\system32\UsrLogon.Cmd

or you can create a TS-specific login script. Check:

195461 - How to Set Up a Logon Script Only for Terminal Server
Users
http://support.microsoft.com/?kbid=195461
 
G

Guest

Thanks for clearing that up Vera.

Can you confirm is this is the correct syntax?

echo %username% %clientname% %date% %time% >> logon.log

i edited the usrlogon.cmd file and added the line as described above, logged on to TS from a remote machine, but no logon.log file in the system32 folder?
 
G

Guest

here's the content of the USRLOGON.CMD file...where should i place the following syntax?
here's the usrlogon.cmd contents, where should i put the following line :
echo %username% %clientname% %date% %time% >> logon.log

________________

@Echo Off

Call "%SystemRoot%\Application Compatibility Scripts\SetPaths.Cmd"
If "%_SETPATHS%" == "FAIL" Goto Done

Rem
Rem This is for those scripts that don't need the RootDrive.
Rem

If Not Exist "%SystemRoot%\System32\Usrlogn1.cmd" Goto cont0
Cd /d "%SystemRoot%\Application Compatibility Scripts\Logon"
Call "%SystemRoot%\System32\Usrlogn1.cmd"

:cont0

Rem
Rem Determine the user's home directory drive letter. If this isn't
Rem set, exit.
Rem

Cd /d %SystemRoot%\"Application Compatibility Scripts"
Call RootDrv.Cmd
If "A%RootDrive%A" == "AA" End.Cmd

Rem
Rem Map the User's Home Directory to a Drive Letter
Rem

Net Use %RootDrive% /D >NUL: 2>&1
Subst %RootDrive% "%HomeDrive%%HomePath%"
if ERRORLEVEL 1 goto SubstErr
goto AfterSubst
:SubstErr
Subst %RootDrive% /d >NUL: 2>&1
Subst %RootDrive% "%HomeDrive%%HomePath%"
:AfterSubst

Rem
Rem Invoke each Application Script. Application Scripts are automatically
Rem added to UsrLogn2.Cmd when the Installation script is run.
Rem

If Not Exist %SystemRoot%\System32\UsrLogn2.Cmd Goto Cont1

Cd Logon
Call %SystemRoot%\System32\UsrLogn2.Cmd


:Cont1

:Done

_____________
 
V

Vera Noest [MVP]

Yes, UsrLogon.Cmd has a lot of conditional statements, making it
difficult to know where to put extra statements.
This can be a very good reason for creating your own login script.

But if you want to add the "echo ..." line to UsrLogon.Cmd, put it on
the very last line, after the ":Done" label.
Whatever your way through the script, you'll always reach the
":Done" label and then run your echo-command.

So the last lines should look:

:Cont1

:Done
echo %username% %clientname% %date% %time% >> logon.log

--
Vera Noest
MCSE, CCEA, Microsoft MVP - Terminal Server
http://hem.fyristorg.com/vera/IT
--- please respond in newsgroup ---

here's the content of the USRLOGON.CMD file...where should i
place the following syntax? here's the usrlogon.cmd contents,
where should i put the following line : echo %username%
%clientname% %date% %time% >> logon.log

< content of UsrLogon.Cmd deleted for brevity >
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top