+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
Scripts Thread, Logged on in Coding and Web Development; one thing i have just found with this is that it wont add to the text file it jsut keeps ...
  1. #16
    DSapseid's Avatar
    Join Date
    Feb 2007
    Location
    West Sussex
    Posts
    1,152
    Thank Post
    130
    Thanked 54 Times in 47 Posts
    Rep Power
    38

    Re: Logged on

    one thing i have just found with this is that it wont add to the text file it jsut keeps overwritting what is already there.

  2. #17

    mattx's Avatar
    Join Date
    Jan 2007
    Posts
    9,240
    Thank Post
    1,058
    Thanked 1,068 Times in 625 Posts
    Rep Power
    740

    Re: Logged on

    AutoIT script which may help:

    ; AutoIt Version: 3.10
    ; Language: English
    ; Platform: WinXP
    ; Author: Matt Marsh
    ; Script Function: Script that records logon details in log file
    ; Date: Oct 2005


    Dim $sLogPath = "c:\logs\logger.txt"
    Dim $sLogMsg = "User: "
    _FileWriteLog($sLogPath, $sLogMsg)

    Func _FileWriteLog($sLogPath, $sLogMsg)

    Local $sDateNow
    Local $sTimeNow
    Local $sMsg
    Local $hOpenFile
    Local $hWriteFile
    Local $user
    Local $cname
    Local $ip

    $sDateNow = "On " & @YEAR & "-" & @MON & "-" & @MDAY
    $sTimeNow = @HOUR & ":" & @MIN & ":" & @SEC
    $user = @UserName
    $cname = @ComputerName
    $ip = @IPAddress1

    $sMsg = $sDateNow & " " & $sTimeNow & " : " & $sLogMsg & $user & " Logged On To PC: " & $cname & "," & " IP Address: " & $ip

    $hOpenFile = FileOpen($sLogPath, 1)

    If $hOpenFile = -1 Then
    SetError(1)
    Return 0
    EndIf

    $hWriteFile = FileWriteLine($hOpenFile, $sMsg)

    If $hWriteFile = -1 Then
    SetError(2)
    Return 0
    EndIf

    FileClose($hOpenFile)
    Return 1
    EndFunc
    Make a dir and file - c:\logs\logger.txt
    Everytime this is run - [ you will need to compile it ], it will add a line to the txt file. This will record details for a local PC only.

  3. #18

    Join Date
    Mar 2007
    Posts
    1,782
    Thank Post
    80
    Thanked 293 Times in 224 Posts
    Rep Power
    86

    Re: Logged on

    use >> not >


    cracking!

  4. #19

    Join Date
    Sep 2006
    Location
    Essex
    Posts
    783
    Thank Post
    1
    Thanked 33 Times in 31 Posts
    Rep Power
    24

    Re: Logged on

    VB would be something like this.

    Code:
    Set objNetwork = CreateObject("Wscript.Network") 
    
    strUser = objNetwork.UserDomain & Chr(92) & objNetwork.UserName

    Which would give you domain\username

    or

    Code:
    strUser = objNetwork.UserName
    Which would give you just the username

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Who is (logged) on..
    By PiqueABoo in forum Scripts
    Replies: 5
    Last Post: 5th August 2007, 12:06 PM
  2. Logged on
    By kevin_lane in forum Scripts
    Replies: 0
    Last Post: 8th May 2007, 01:55 PM
  3. Seeing who is logged on
    By faza in forum Wireless Networks
    Replies: 5
    Last Post: 6th December 2006, 09:19 AM
  4. Who last logged on
    By danIT in forum Windows
    Replies: 1
    Last Post: 2nd October 2006, 09:08 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •