scripting@wanadoo.nl




LastLogged()

http://www.scriptlogic.com/kixtart/FunctionLibrary_FunctionList.aspx


actual FunctionLibrary list on 'Scriptlogic' site printer-friendly mirror of UDF topic on 'scripting@wanadoo.nl' site close
17 May 2002 LastLogged()
AuthorKent Dyer (dyerkb@myrealbox.com)
Action Show users that have not logged in 30 days.
SyntaxLastLogged ("DOMAIN")
-or-
LastLogged (@DOMAIN)
-or-
LastLogged () 
Parameters
  • $Domain (Required / String)  
  • RemarksList all users on the domain: http://www.kixtart.org/board/ultimatebb.php?ubb=get_topic;f=2;t=002703 - Thanks Bryce!
    Users that have not logged on in 30 days: http://cwashington.netreach.net/depo/view.asp?Index=323&ScriptType=vbscript
    Create Loginlog: http://infocenter.cramsession.com/TechLibrary/GetHtml.asp?ID=721&GetDes=&CatID=293 
    ReturnsWrites to screen / Writes to log file 
    DependenciesKixtart 4.x, Active Directory, DateMath(), SerialDate() 
    Examples
    LastLogged(yourserver.yourdomain.com)
    LastLogged()
    
     
    Source
    FUNCTION LastLogged ($domain)
      $domain=GetObject("WinNT://@domain")
      IF @error <> 0
        EXIT(1)
      ENDIF
    
      FOR EACH $thing IN $domain
        IF $thing.class = "USER"
          $chklast=$thing.lastlogin ; ChkLast is used to determine the last logon time.
         ;IF ($chklast > (DateMath(@date,-30)) OR $chklast = "" ) AND $thing.userflags <> 661103 AND $thing.userflags <> 515
          IF ($chklast < datemath(@date,-30)) OR $chklast = ""
           ;IF $chklast = ""
           ;IF $thing.lastlogin <> ""
            ? $thing.name
            $result=SetConsole('show')
            $logshare="D:\!kix"
            IF ($chklast = "")
              $logdata=$thing.name+Chr(13)+Chr(10)
            ELSE
              $logdata=$thing.name+","+$thing.lastlogin+Chr(13)+Chr(10)
            ENDIF
            $logfile=$logshare+'\HaveLogged.csv'
            ;-- Log the user into a file
            $result=0
            $n=0
            DO
              $result=Open(1, $logfile, 5)
              IF ($result <> 0)
                IF ($n = 0)
                  ;First wait
                  ? "Please wait"
                ELSE
                  ;follow waits
                  "."
                ENDIF
                SLEEP 3
              ELSE
                $result=WriteLine(1, $logdata)
                $result=Close(1)
              ENDIF
              $n=$n+1
            UNTIL ($result = 0) OR ($n = 5)
           ;ENDIF
          ENDIF
        ENDIF
      NEXT
    ENDFUNCTION ; - LastLogged -
     
      original source of UDF topic. show actual FunctionLibrary list on Scriptlogic site close top
              printer-friendly mirror of UDF topic on scripting@wanadoo.nl site  




    Copyright © 2003 www.scriptlogic.com & scripting@wanadoo.nl - last updated on 20 May 2003


    Site Meter