0

I am not an administrator of my corporate laptop, but I belong to the "Network Configuration Operators" group. With that permission I can change the IP address and routes.

For it to work the process has to be in a kind of user-elevated mode (not plain user, not administrator).

I have a BAT script that changes routes, and the way it works is:

  1. Right click -> Run as Administrator
  2. Use my own user (yes, the same plain user i was, not "administrator")
  3. The script runs fine

That works fine, but i'd like to skip the right clicking.

I thought that "runas" command would work, but it doesn't get enough elevation. How can I make this work?

LatinSuD
  • 841
  • 1
  • 8
  • 15

1 Answers1

0

Apparently, Powershell's Start-Process can do what runas can't.

powershell Start-Process -Verb RunAs -FilePath MyCommand

If I run the program like that (it's actually a WSL script) it gets enough elevation to be able to change the routes.

I feel like there should be options in both commands, so I can tell whether I want elevation or not.

LatinSuD
  • 841
  • 1
  • 8
  • 15