Page 1 of 1 1
Topic Options
#210228 - 2015-05-03 12:32 AM guidance needed for adding last user logon time to welcome message
chevv Offline
Just in Town

Registered: 2015-05-02
Posts: 2
Loc: estonia
I would like to display user last login time on logon pop up.

I can get the correct logon info from the following CMD command:
 Code:
user %username% /DOMAIN | findstr /B /C:"Last logon"


Is there a way to integrate this CMD command into kix script line...
 Code:
MESSAGEBOX("Some welcome message!","A messagebox",64,5)


...so that the result would look something like this?


Top
#210229 - 2015-05-03 02:03 AM Re: guidance needed for adding last user logon time to welcome message [Re: chevv]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4574
Loc: USA
I'm in a giving mood tonight... \:\)

 Code:
$RC=MESSAGEBOX("Some welcome message!" + @CRLF + @CRLF + "Last Logon " +  GetLastLogin(),"A messagebox",64,5)

Function GetLastLogin(optional $username)
  Dim $objTrans
  if $username=""
    $username=@ldomain + "\"+ @userid
  endif
  if not instr($username,"\")
    $username=@ldomain + "\" + $username
  endif
  $objTrans = CreateObject("NameTranslate")
  if @error
    exit @error
  else
    $objTrans.Init(3, "")
    $objTrans.Set(3,$username)
    $GetLastLogin=GetObject("LDAP://" + $objTrans.Get(1)).LastLogin
    if @error
      exit @error
    endif
  endif
EndFunction

_________________________
(... better days ahead)

Top
#210230 - 2015-05-03 12:27 PM Re: guidance needed for adding last user logon time to welcome message [Re: Allen]
chevv Offline
Just in Town

Registered: 2015-05-02
Posts: 2
Loc: estonia
That works perfectly!

Thank you so much Allen!

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
1 registered (Henriques) and 2516 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.055 seconds in which 0.029 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