Page 1 of 1 1
Topic Options
#211309 - 2016-04-13 09:41 PM Log File - Login
j460390 Offline
Just in Town

Registered: 2016-04-13
Posts: 3
Loc: USA
Hi,

I'd like to be able to write a script which does the following at log on

Writes the following to a log file (txt file)

-logon time and date
-workstation
-username

is this possible?

James

Top
#211310 - 2016-04-13 09:42 PM Re: Log File - Login [Re: j460390]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
Yes, it's possible.
Top
#211311 - 2016-04-13 09:44 PM Re: Log File - Login [Re: ShaneEP]
j460390 Offline
Just in Town

Registered: 2016-04-13
Posts: 3
Loc: USA
Thank you for your reply. Do you have any idea on how to do this, or where I can look? I already have a login script mapping drives / printers. Hoping to add this to it!

Edited by j460390 (2016-04-13 09:45 PM)

Top
#211312 - 2016-04-13 09:46 PM Re: Log File - Login [Re: j460390]
ShaneEP Moderator Offline
MM club member
*****

Registered: 2002-11-29
Posts: 2125
Loc: Tulsa, OK
For simple info logging, I would begin by looking at the RedirectOutput() function, and the list of built in Macros.

Use the below link to download one of the newer CHM help files.

http://www.kixtart.org/forums/ubbthreads.php?ubb=download&Number=245

Top
#211313 - 2016-04-13 09:49 PM Re: Log File - Login [Re: ShaneEP]
j460390 Offline
Just in Town

Registered: 2016-04-13
Posts: 3
Loc: USA
Thank you so much for your help. I am able to do this now!
Top
#211314 - 2016-04-13 10:42 PM Re: Log File - Login [Re: j460390]
Glenn Barnas Administrator Offline
KiX Supporter
*****

Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
Here's an example of the log from our login script:
 Code:
NAC Checking is ENABLED.
=========================================================
2016/03/31  -  08:25:51
          Kixtart: 4.63
          Version: 2.8.7
         INI File: C:\Users\gbarnas\AppData\Local\Temp\login.ini (cached)
             User: Glenn Barnas / gbarnas
Locale / Language: 1033 / English (United States)
      LoginServer: \\DC01
           Domain: XXXXXX
       User OU DN: OU=Employees,OU=User Accounts - Regular,OU=Users,OU=UCRoot,DC=xxxxxx,DC=com
   User OU Offset: 0
          User OU: Employees
  Wkstn OU Offset: 0
      Wkstn OU DN: OU=Mobile,OU=Workstations,OU=Computers,OU=UCRoot,DC=xxxxxx,DC=com
         Wkstn OU: Mobile
       Logon Mode: 1
           Laptop: 1
     Detected O/S: Windows 7 Professional Edition / Version 6.1
        Privelege: USER
  Local Privelege: User
        ScriptDir: C:\windows\system32 / C:\windows\system32
         StartDir: \\dc01\netlogon
     User Process: 0
     Session Type: Console
      LP Hard Map: 0
      Debug Level: 1

 Group Membership: 
                    Domain Users
                    Everyone
                    Users
                    Remote Desktop Users
                    Authenticated Users
                    OG-Technicians
                    AC-RDS Access - RDS Hosts
                    OG-Employees
                    RC-VSAFiles
                    Users
                    AfterHours

 - ENVIRONMENT START - 
ACPath=C:\Program Files (x86)\Lenovo\Access Connections\
ALLUSERSPROFILE=C:\ProgramData
<SNIP>
windir=C:\windows
windows_tracing_flags=3
windows_tracing_logfile=C:\BVTBin\Tests\installpackage\csilogfile.log
 - ENVIRONMENT END - 

Processing active resources:
   Disk: G	\\file\common
   Disk: J	\\file\Downloads
   Disk: U	HOME
Printer: 	\\print\HPLJ4200m	S
		SoftMap - Exists
		Pre-existing default
Printer: 	\\print\XP4600m	N
		SoftMap - Exists
You can see that logging can be quite detailed. Our script displays login info and logs the debug level info.

As Shane mentioned, using RedirectOutput('logfile') at the start of your script will put every message to the log file. If you want to mix log and screen output, you might want to use a function that flips the redirection on and off. The fMsg() function on my web site does just this. Simply call fMsg('screen message', 'log message', options...)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 415 anonymous users online.
Newest Members
SERoyalty, mytar, Gabriel, Alex_Evos, Dansen
17869 Registered Users

Generated in 0.056 seconds in which 0.025 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org