Auto-lock (Win+L) computer if Ethernet cable is removed or Ethernet signals drops
Multi tool use
up vote
0
down vote
favorite
I want to make my system auto lock whenever I disconnect the Ethernet cable or my LAN signals drops. I'm using Windows 7 and Windows 10.
windows shell-script lock
add a comment |
up vote
0
down vote
favorite
I want to make my system auto lock whenever I disconnect the Ethernet cable or my LAN signals drops. I'm using Windows 7 and Windows 10.
windows shell-script lock
Welcome to Super User! Please note we are not a code-writing service, and questions seeking product recommendations are off-topic. Instead, post specific issues you are having with a script (for example), and folks may be able to help with that. Cheers!
– bertieb
Dec 1 at 13:44
1
Also, just supposing hypothetically it happened to be in a corporate environment you wanted to enforce something like that, you may be better off pursuing non-technical avenues of approach.
– bertieb
Dec 1 at 13:49
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I want to make my system auto lock whenever I disconnect the Ethernet cable or my LAN signals drops. I'm using Windows 7 and Windows 10.
windows shell-script lock
I want to make my system auto lock whenever I disconnect the Ethernet cable or my LAN signals drops. I'm using Windows 7 and Windows 10.
windows shell-script lock
windows shell-script lock
edited Dec 3 at 0:53
Twisty Impersonator
17.3k126394
17.3k126394
asked Dec 1 at 13:31
CYREX
32
32
Welcome to Super User! Please note we are not a code-writing service, and questions seeking product recommendations are off-topic. Instead, post specific issues you are having with a script (for example), and folks may be able to help with that. Cheers!
– bertieb
Dec 1 at 13:44
1
Also, just supposing hypothetically it happened to be in a corporate environment you wanted to enforce something like that, you may be better off pursuing non-technical avenues of approach.
– bertieb
Dec 1 at 13:49
add a comment |
Welcome to Super User! Please note we are not a code-writing service, and questions seeking product recommendations are off-topic. Instead, post specific issues you are having with a script (for example), and folks may be able to help with that. Cheers!
– bertieb
Dec 1 at 13:44
1
Also, just supposing hypothetically it happened to be in a corporate environment you wanted to enforce something like that, you may be better off pursuing non-technical avenues of approach.
– bertieb
Dec 1 at 13:49
Welcome to Super User! Please note we are not a code-writing service, and questions seeking product recommendations are off-topic. Instead, post specific issues you are having with a script (for example), and folks may be able to help with that. Cheers!
– bertieb
Dec 1 at 13:44
Welcome to Super User! Please note we are not a code-writing service, and questions seeking product recommendations are off-topic. Instead, post specific issues you are having with a script (for example), and folks may be able to help with that. Cheers!
– bertieb
Dec 1 at 13:44
1
1
Also, just supposing hypothetically it happened to be in a corporate environment you wanted to enforce something like that, you may be better off pursuing non-technical avenues of approach.
– bertieb
Dec 1 at 13:49
Also, just supposing hypothetically it happened to be in a corporate environment you wanted to enforce something like that, you may be better off pursuing non-technical avenues of approach.
– bertieb
Dec 1 at 13:49
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
According to this answer: https://superuser.com/a/225251/950764 an event will be created when your connections drops. The ID will be 27 and the source depends on your network card. (the answer mentions "e1yexpress" but for me it is "e1dexpress")
This allows you to create and event in Task Scheduler that will execute when your connections drops.
- Open Event Viewer and filter for Events with the ID 27 and level "Warning" under
Windows Logs -> System.
- Now you should see events mentioning your network cards name and the text "Network
link is disconnected" (assuming this has been the case till now). Most importantly
you will now know the events source, which
you need to use for the scheduled task. - Open Task Scheduler and create a new task.
- In the properties window that opens give the task an name.
- In the Trigger tab create a new trigger and select "On a new event". Set Log to
"System", source to the name you got from Event Viewer and Event ID to 27. Press OK. - Now go to the Actions tab a and create a new action. In the windows that opens select
"Start a program" and enterrundll32.exe
as program
path anduser32.dll,LockWorkStation
as arguments . - You may want to customize the task a bit further like disabling the fact that the
task will only run if the power is plugged in under the Conditions tab (mostly
relevant for laptops)
After doing this I recommend disconnecting your network cable to check if everything works as expected.
I will try it. Thanks for very informative/applicable answer.
– CYREX
Dec 1 at 14:18
It worked at my home computer. I want to implement it at my office. I m using windows server 2008 as a server and i want to deploy this task to all my domain users. As every system has its own network card and source will be different for each computer. Is there anyway i can put universal source name for network disconnection or i have to go to each computer to create that task?
– CYREX
Dec 1 at 14:58
In that case you could switch the trigger from Basic to Custom. If you press new Event Filter and switch to "By source" you can select multiple sources. If you only have very few computer models you could check there event logs and see how the source is called and add them all.
– User025
Dec 1 at 15:07
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
According to this answer: https://superuser.com/a/225251/950764 an event will be created when your connections drops. The ID will be 27 and the source depends on your network card. (the answer mentions "e1yexpress" but for me it is "e1dexpress")
This allows you to create and event in Task Scheduler that will execute when your connections drops.
- Open Event Viewer and filter for Events with the ID 27 and level "Warning" under
Windows Logs -> System.
- Now you should see events mentioning your network cards name and the text "Network
link is disconnected" (assuming this has been the case till now). Most importantly
you will now know the events source, which
you need to use for the scheduled task. - Open Task Scheduler and create a new task.
- In the properties window that opens give the task an name.
- In the Trigger tab create a new trigger and select "On a new event". Set Log to
"System", source to the name you got from Event Viewer and Event ID to 27. Press OK. - Now go to the Actions tab a and create a new action. In the windows that opens select
"Start a program" and enterrundll32.exe
as program
path anduser32.dll,LockWorkStation
as arguments . - You may want to customize the task a bit further like disabling the fact that the
task will only run if the power is plugged in under the Conditions tab (mostly
relevant for laptops)
After doing this I recommend disconnecting your network cable to check if everything works as expected.
I will try it. Thanks for very informative/applicable answer.
– CYREX
Dec 1 at 14:18
It worked at my home computer. I want to implement it at my office. I m using windows server 2008 as a server and i want to deploy this task to all my domain users. As every system has its own network card and source will be different for each computer. Is there anyway i can put universal source name for network disconnection or i have to go to each computer to create that task?
– CYREX
Dec 1 at 14:58
In that case you could switch the trigger from Basic to Custom. If you press new Event Filter and switch to "By source" you can select multiple sources. If you only have very few computer models you could check there event logs and see how the source is called and add them all.
– User025
Dec 1 at 15:07
add a comment |
up vote
1
down vote
accepted
According to this answer: https://superuser.com/a/225251/950764 an event will be created when your connections drops. The ID will be 27 and the source depends on your network card. (the answer mentions "e1yexpress" but for me it is "e1dexpress")
This allows you to create and event in Task Scheduler that will execute when your connections drops.
- Open Event Viewer and filter for Events with the ID 27 and level "Warning" under
Windows Logs -> System.
- Now you should see events mentioning your network cards name and the text "Network
link is disconnected" (assuming this has been the case till now). Most importantly
you will now know the events source, which
you need to use for the scheduled task. - Open Task Scheduler and create a new task.
- In the properties window that opens give the task an name.
- In the Trigger tab create a new trigger and select "On a new event". Set Log to
"System", source to the name you got from Event Viewer and Event ID to 27. Press OK. - Now go to the Actions tab a and create a new action. In the windows that opens select
"Start a program" and enterrundll32.exe
as program
path anduser32.dll,LockWorkStation
as arguments . - You may want to customize the task a bit further like disabling the fact that the
task will only run if the power is plugged in under the Conditions tab (mostly
relevant for laptops)
After doing this I recommend disconnecting your network cable to check if everything works as expected.
I will try it. Thanks for very informative/applicable answer.
– CYREX
Dec 1 at 14:18
It worked at my home computer. I want to implement it at my office. I m using windows server 2008 as a server and i want to deploy this task to all my domain users. As every system has its own network card and source will be different for each computer. Is there anyway i can put universal source name for network disconnection or i have to go to each computer to create that task?
– CYREX
Dec 1 at 14:58
In that case you could switch the trigger from Basic to Custom. If you press new Event Filter and switch to "By source" you can select multiple sources. If you only have very few computer models you could check there event logs and see how the source is called and add them all.
– User025
Dec 1 at 15:07
add a comment |
up vote
1
down vote
accepted
up vote
1
down vote
accepted
According to this answer: https://superuser.com/a/225251/950764 an event will be created when your connections drops. The ID will be 27 and the source depends on your network card. (the answer mentions "e1yexpress" but for me it is "e1dexpress")
This allows you to create and event in Task Scheduler that will execute when your connections drops.
- Open Event Viewer and filter for Events with the ID 27 and level "Warning" under
Windows Logs -> System.
- Now you should see events mentioning your network cards name and the text "Network
link is disconnected" (assuming this has been the case till now). Most importantly
you will now know the events source, which
you need to use for the scheduled task. - Open Task Scheduler and create a new task.
- In the properties window that opens give the task an name.
- In the Trigger tab create a new trigger and select "On a new event". Set Log to
"System", source to the name you got from Event Viewer and Event ID to 27. Press OK. - Now go to the Actions tab a and create a new action. In the windows that opens select
"Start a program" and enterrundll32.exe
as program
path anduser32.dll,LockWorkStation
as arguments . - You may want to customize the task a bit further like disabling the fact that the
task will only run if the power is plugged in under the Conditions tab (mostly
relevant for laptops)
After doing this I recommend disconnecting your network cable to check if everything works as expected.
According to this answer: https://superuser.com/a/225251/950764 an event will be created when your connections drops. The ID will be 27 and the source depends on your network card. (the answer mentions "e1yexpress" but for me it is "e1dexpress")
This allows you to create and event in Task Scheduler that will execute when your connections drops.
- Open Event Viewer and filter for Events with the ID 27 and level "Warning" under
Windows Logs -> System.
- Now you should see events mentioning your network cards name and the text "Network
link is disconnected" (assuming this has been the case till now). Most importantly
you will now know the events source, which
you need to use for the scheduled task. - Open Task Scheduler and create a new task.
- In the properties window that opens give the task an name.
- In the Trigger tab create a new trigger and select "On a new event". Set Log to
"System", source to the name you got from Event Viewer and Event ID to 27. Press OK. - Now go to the Actions tab a and create a new action. In the windows that opens select
"Start a program" and enterrundll32.exe
as program
path anduser32.dll,LockWorkStation
as arguments . - You may want to customize the task a bit further like disabling the fact that the
task will only run if the power is plugged in under the Conditions tab (mostly
relevant for laptops)
After doing this I recommend disconnecting your network cable to check if everything works as expected.
answered Dec 1 at 14:04
User025
27310
27310
I will try it. Thanks for very informative/applicable answer.
– CYREX
Dec 1 at 14:18
It worked at my home computer. I want to implement it at my office. I m using windows server 2008 as a server and i want to deploy this task to all my domain users. As every system has its own network card and source will be different for each computer. Is there anyway i can put universal source name for network disconnection or i have to go to each computer to create that task?
– CYREX
Dec 1 at 14:58
In that case you could switch the trigger from Basic to Custom. If you press new Event Filter and switch to "By source" you can select multiple sources. If you only have very few computer models you could check there event logs and see how the source is called and add them all.
– User025
Dec 1 at 15:07
add a comment |
I will try it. Thanks for very informative/applicable answer.
– CYREX
Dec 1 at 14:18
It worked at my home computer. I want to implement it at my office. I m using windows server 2008 as a server and i want to deploy this task to all my domain users. As every system has its own network card and source will be different for each computer. Is there anyway i can put universal source name for network disconnection or i have to go to each computer to create that task?
– CYREX
Dec 1 at 14:58
In that case you could switch the trigger from Basic to Custom. If you press new Event Filter and switch to "By source" you can select multiple sources. If you only have very few computer models you could check there event logs and see how the source is called and add them all.
– User025
Dec 1 at 15:07
I will try it. Thanks for very informative/applicable answer.
– CYREX
Dec 1 at 14:18
I will try it. Thanks for very informative/applicable answer.
– CYREX
Dec 1 at 14:18
It worked at my home computer. I want to implement it at my office. I m using windows server 2008 as a server and i want to deploy this task to all my domain users. As every system has its own network card and source will be different for each computer. Is there anyway i can put universal source name for network disconnection or i have to go to each computer to create that task?
– CYREX
Dec 1 at 14:58
It worked at my home computer. I want to implement it at my office. I m using windows server 2008 as a server and i want to deploy this task to all my domain users. As every system has its own network card and source will be different for each computer. Is there anyway i can put universal source name for network disconnection or i have to go to each computer to create that task?
– CYREX
Dec 1 at 14:58
In that case you could switch the trigger from Basic to Custom. If you press new Event Filter and switch to "By source" you can select multiple sources. If you only have very few computer models you could check there event logs and see how the source is called and add them all.
– User025
Dec 1 at 15:07
In that case you could switch the trigger from Basic to Custom. If you press new Event Filter and switch to "By source" you can select multiple sources. If you only have very few computer models you could check there event logs and see how the source is called and add them all.
– User025
Dec 1 at 15:07
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1379966%2fauto-lock-winl-computer-if-ethernet-cable-is-removed-or-ethernet-signals-drop%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Bm,FmJ9G4JD i1UsmcxGURHZj9HEkwXb jSw8GFNAi4X7hPuCjT,Q R0Joa m 5N,o,s
Welcome to Super User! Please note we are not a code-writing service, and questions seeking product recommendations are off-topic. Instead, post specific issues you are having with a script (for example), and folks may be able to help with that. Cheers!
– bertieb
Dec 1 at 13:44
1
Also, just supposing hypothetically it happened to be in a corporate environment you wanted to enforce something like that, you may be better off pursuing non-technical avenues of approach.
– bertieb
Dec 1 at 13:49