4

I need to disable LAN connection for one certain standard user on laptop.

I want my daughter to have

  1. unlimited access to internet on wi-fi in library/school etc (user1 with disabled LAN)
  2. limited access (user2 with parental controls) when connected home via LAN.

Any ideas, please?

Windows 7 Home, Sony Vaio

thank you, gentlemen

2
  • Do you want the LAN interface disabled only while your daughter Ida logged in? Something else? Mar 15, 2018 at 1:01
  • Yes, thats the point
    – Corto
    Mar 15, 2018 at 1:10

1 Answer 1

2

The easiest way to do this is to make a custom logon script that runs when user2 logs in to windows via scheduled task. (Windows home disables logon scripts for users, so we have to get around it with this method.)

The only prerequisite requires that you know the name of the interface(s) that you want to disable upon login.

To get a list of all the interfaces:

  1. Open command prompt by holding down the Windows key and then pressing the R key. This will give you run box.
  2. Now, type cmd into that box and press enter.
  3. Type netsh interface show interface and take note of the interface name in the last column. This could be something like "local area connection" or "wi-fi", etc.

Now, we need to make a script to actually disable this adapter. From here on out, I will assume that your adapters name is "Wi-Fi" (yours may be different).

  1. Open a new notepad document.
  2. Paste in the following: netsh interface set interface "Wi-Fi" admin=disable
  3. Save the file as "turnOffNetwork.bat" ** Use the quotes when you save it. This will force the file to be saved with the .bat extension.
  4. The file needs to be saved to a place where her profile can see it, so I would create a folder called scripts directly on the c:\ drive.
  5. When you save it, the location should be C:\Scripts\turnOffNetwork.bat

Now we need to login to the profile that this will run as. In this case, login to user2.

  1. Click the start button and type task scheduler and open it.
  2. On the far right, choose Create Task. Do not choose basic task.
  3. There will be 5 tabs here, General, Triggers, Actions, Conditions and Settings.

General Tab:

  • Name: Turn off Network Access
  • Choose "Run only when user is logged on"
  • Tick the box for "Run with highest privileges" (needed)

Triggers Tab:

  • Click "New"
  • Begin the task dropdown: "At Logon"
  • Press OK

Actions Tab:

  • Click "New"
  • Action: Start a program
  • Browse for program/script and choose C:\Scripts\turnOffNetwork.bat
  • Click OK

Conditions Tab:

  • Uncheck: "Start the task only if AC is on"
  • Uncheck: "Stop if computer switches to battery"
  • Click OK

Settings Tab:

  • No changes.

Press OK. You may now be prompted with a credential asking for admin credentials. If this is the case, enter the username/password of an account on the computer that is an administrator. (most likely your profile, not your daughters.)

Log out of user2 and back in as user2 and the task should now run, disabling the network card/wifi adapter.

3
  • 2
    Works like a charm! Thank you, Narzard. You gave me this last piece of puzzle I needed.
    – Corto
    Mar 15, 2018 at 22:28
  • 2
    And with the opposite script I can even automatically enable LAN for home access. Manual disable/enable is restricted by admin password... everything is perfect. You rock! Have a nice day!
    – Corto
    Mar 15, 2018 at 22:31
  • 1
    @Corto Glad I could help! Can you mark it as the answer for others to reference?
    – Narzard
    Mar 15, 2018 at 22:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .