1

I have two network connections and what I need to be able to do is when a specific user logs in to either disable an interface or force use of a specific interface which ever is easiest.

I can disable using

netsh interface set interface name="Local Area Connection" admin=disabled

however i'm not sure how to setup so it only does it for specific users.

0

1 Answer 1

0

How do I run a script when a user logs in

Use a logon script.

Applies To: Windows 7, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012

Administrators is the minimum group membership required to complete this procedure. Review the details in "Additional considerations" in this topic. To assign a logon script to a local user account

  1. Open Computer Management.

  2. In the console tree, click Users.

    Where?

    • Computer Management\System Tools\Local Users and Groups\Users
  3. Right-click the user account that you want, and then click Properties .

  4. On the Profile tab, in Logon script , type the file name and relative path of the script.

Source Assign a logon script to a local user account

4
  • I created a batch script in c:\batchscripts then created a shortcut to it in the same folder and selected 'run as administrator' form the properties section. I then added > Profile Path: C:\batchscripts > Logon Script: disablelan-Shortcut.lnk for the non admin user. When I click on the .Ink file as an admin user I get a pop up box 'following program want sto make changes' etc etc.
    – Lurch
    Jun 7, 2015 at 18:35
  • What happens if you don't use a shorcut lnk, but click on the batch file?
    – DavidPostill
    Jun 7, 2015 at 18:41
  • I get "An interface with this name is not registered with the router." this is due to it not being run as admin.
    – Lurch
    Jun 7, 2015 at 19:07
  • @Lurch You cannot mark system applications or processes to always run with administrator privileges. Only non-system applications and processes can be marked to always run at this level. See Configure Applications to Always Run as an Administrator for more information.
    – DavidPostill
    Jun 7, 2015 at 19:19

You must log in to answer this question.

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