sending email upon logon

Am working with W2k - what I need is some form of script or program that will email me when a user logs into the server?
Who is Participating?
craylordConnect With a Mentor Commented:
go to and download kixtart.
On your domain controller there should be a share called netlogon. Extract the kixtart program files there. This is where the user will run the kixtart.exe from. If you don't have that share, you can create a share elsewhere and point to it in Active Directory. I'll describe that later.

Copy the script above into a .txt file and rename it as a .kix file i.e. login.kix
Add this in a line before the net use...
break on
break on will let the script be cancelled by pushing ctrl + c without logging the user off. helpful for testing. Place this login.kix with the kixtart programs in the share.

In the user properties under the profile tab enter this into the login script box.
kix32.exe login.kix
If you don't have a netlogon share you can create a share elsewhere. Put the kixtart program in that share as well as the login.kix


If you place the share elsewhere, you will have to put the path in the login script box instead.
\\server01\kix\kix32.exe "\\server01\kix\login.kix"

It would be easier to have the script write the information to a log file on a local server or domain controller. This is what we do with kixtart. You will want a share on a server with the following folders. users need write permissions to this folder.
and a text file here

; The first portion of the script does five things
;  1)  Writes basic computer information to a text file = NetBIOS
;      name.txt (overwrites)
;  2)  Writes logon time to a text file = username.txt (appends)
;  3)  Writes logon time to a text file = NetBIOS name.txt (appends)
;  4)  Writes all logon info to a .csv file (appends)
;  5)  Writes computer info to a .csv one time only for inventory
;      purposes

Use Z: /Delete /persistent
Use Z: "\\server01\log"

; 1)  Basic computer info for reference

ReDirectOutput ("Z:\Inventory\@WKSTA.txt",1)

  ?"NetBIOS name = "@WKSTA

  ?"Last login by "@USERID

  ?"OS = "@PRODUCTTYPE" with "@CSD

  ?"Memory = "MemorySize(0)" MB"

  ?"Processor type is "@CPU

  ?"Processor speed is "@MHZ

  ?"IP address = "@IPADDRESS0

  ?"MAC address = "@ADDRESS

  ?"This information was gathered on "@DATE" at "@TIME
; 2)  Tracks all logons by user

ReDirectOutput ("Z:\Logins\@USERID.txt",0)

  ?@USERID" logged into the "@domain" domain on "@WKSTA" at "@TIME" on "@DATE"   "
; 3)  Tracks all logons by computer

ReDirectOutput ("Z:\Logins\Computer\@WKSTA.txt",0)

  ?@USERID" logged into the "@domain" domain on "@WKSTA" at "@TIME" on "@DATE"   "
; 4)  Records all logon info to a .csv file

ReDirectOutput ("Z:\Logins\CSV\logins.txt",0)

; 5)  Records computer info one time to a .csv file and copies a check file
;     to prevent future writes of same computer

If Exist ("c:\check3.txt")

      Goto "software"

ReDirectOutput ("Z:\Inventory\CSV\inventory.txt",0)


Copy "Z:\check3.txt" "c:\check3.txt"

;  The second part of this script performs an inventory of installed software on a PC
;  by examining the portion of the registry where uninstall information is kept.
;  The information is then recorded to a text file = computer name that is overwritten
;  with each successive logon.


ReDirectOutput ("Z:\Software\@HOSTNAME.txt", 1)
?"Software installed on @HOSTNAME as of @DATE"

;  Scroll through each subkey

$Index = 0


$KeyName = EnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", $Index)
If @ERROR = 0
  Goto DisplayCheck
  Goto End


;  Check for DisplayName string, record information if it exists

$Displayname = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$Keyname", "DisplayName")
;  DisplayName exists

If @ERROR = 0
  $Index = $Index + 1
  Goto Loop1
;  DisplayName does not exist
  $Index = $Index + 1
  Goto Loop1


;  Finished checking all subkeys, exit program

Use Z: /Delete /persistent
FUNCTION WMIQuery($what,$where,)
      dim $strQuery, $objEnumerator, $value
      $strQuery = "Select $what From $where"
      $SystemSet = GetObject("winmgmts:{impersonationLevel=impersonate}!//@WKSTA")
      $objEnumerator = $SystemSet.ExecQuery($strQuery)
      For Each $objInstance in $objEnumerator
            If @Error = 0 and $objInstance <> ""
                  $=execute("$$value = $$objInstance.$what")
                  EndIf            Next      $WMIQuery=left($WMIQuery,len($WMIQuery)-1)
      exit @error
$computer = @wksta
;? WMIQuery2("Services on","Win32_Service")
;? WMIQuery2("Processes on","Win32_Process")
FUNCTION WMIQuery2($what,$where,)
 $wmi = GetObject("winmgmts:{impersonationLevel=impersonate}!//" + $computer + "/root/cimv2")
 $list = ""
 $objs = $wmi.instancesof($where)
 for each $obj in $objs
 $list = $list + $obj.description  + chr(13) + chr(10)
 $list=Left($list, Len($list))
; ?$what +" "+ $computer + chr(13) + chr(10) + $list
tbaseflugAuthor Commented:
craylord -

I am an idiot when it comes to OS scripts - how and what do I need to do to get this to run - is it a login script?
tbaseflugAuthor Commented:
craylord -

THanks - let me give it a try - our DC is down right now but will test it right after it gets back online
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.