Y
Y
Yaroslav Volodymyrovich2014-03-13 11:16:44
cmd/bat
Yaroslav Volodymyrovich, 2014-03-13 11:16:44

How to implement a notification about unlocking a computer?

Good afternoon. There are 2 users on the PC (their name is Administrator, User)
I need that when a blocked 1 (win + l) user account is unlocked, a notification comes to the mail that such and such has entered the PC.
I have such a .bat file

set file_blat=blat.exe
<b>echo %username% %date% %time% >> C:\task\inuser.txt</b>
set file_text=C:\task\inuser.txt
set file_log=C:\task\log_blat_send.txt
set from_server
set from_port=587
set from_mail=
set from_name=
set from_pass=gigaf5
set to_mail=
set to_subject="inuser"
%file_blat% %file_text%   -server %from_server%:%from_port% -f %from_mail% -u %from_name% -pw %from

As you can see, the selected text writes information about users to us and sends the result to a file.
This script is launched in my Task Scheduler by a tritter When a workstation (any user) is unlocked.
If I manually launch this task by logging in as a specific user, then the notification arrives in the mail correctly with the username, but if the task is performed automatically, then the notification comes with the name of only one user (Administrator, by the way, this task was created by this user) and It doesn't matter if I logged in as an Administrator or as a User, but it notifies that a user named Administrator has logged in.
How to set up a task in the scheduler so that the notification is with the username under which the user logged in?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maxaon, 2014-03-13
@maxaon

If you only have two users - do two different tasks for each user by selecting the user accordingly when creating the trigger.
Another option is to enable login auditing and get the user from the last event.
You can also insert a batch file into the autorun for the user.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question