Sign in to follow this  
Followers 0
SnYder

Remote messages on an internal network

5 posts in this topic

A copy of my script has been placed on a network drive accessible to all users in my org. I would like to get a notification of people who have accessed or installed the script. Is there a way to do this? Please help. Thanks.

Share this post


Link to post
Share on other sites



what type of notification?

if your after a realtime message you might be able to use something like net send (yuck) or have it email you... or if it's just a log you could have it save a log file to a network drive that everyone has rights to with the date and time a particular user ran the app.

Share this post


Link to post
Share on other sites

1: Security logging in your OS

2: Added code to write to a commonly accessible log file when your script is run

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

2: Added code to write to a commonly accessible log file when your script is run

Here's some code you might want to use. You can either make it commonly accessible for directory for all or you can use some preset 'login/pass/domain' to access it with only your program (that way you can make sure that only this user can write to that log).

#Include <Date.au3>
#include <File.au3>

Global $CurrentServer = "server"
Global $PathOnShareForLog = "SharedDir"
Global $domain_name = "your_domain" ; Or you can add here for example ServerName if it's not in Domain
Global $domain_login = "login to use";
Global $domain_pass = "pass for login"

DriveMapAdd("","" & $CurrentServer & $PathOnShareForLog,0,$domain_name & "" & $domain_login ,$domain_password) ; This won't map drive. It will just make proper connection to CurrentServer with proper access rights)
Global $log_file = "" & $CurrentServer & "" & $PathOnShareForLog & "" & "program_usage.log" 

_AddLogToFile(@ComputerName & " - " & @UserName)

Func _AddLogToFile($Text)
    If $logging_to_file = "Yes" Then
        $file_log = FileOpen($log_file, 1)
        FileWriteLine($file_log, "[" & _NowTime(5) & "] - " & $Text & @CRLF)
        FileClose($file_log)
    EndIf
EndFunc   ;==>_AddLogToFile

Something like that should work. I haven't tested it so might be some typos or so ;) But it should work :P

Edit: Not sure about includes but you can check it for yourself right ?:whistle:

Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Share this post


Link to post
Share on other sites

what type of notification?

if your after a realtime message you might be able to use something like net send (yuck) or have it email you... or if it's just a log you could have it save a log file to a network drive that everyone has rights to with the date and time a particular user ran the app.

Perfect I was looking everywhere and it never dawned upon me that a log file is the way to go. Thanks.

;) >> :whistle:

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0