0

I have a script which has to run from an administrator level powershell/cmd prompt Why? Because it has to use logman to get windows counters Problem: The software for which I want to log the windows counters for has to be started with regular user level rights. I've seen that there are lots of examples on how to run as Administrator I don't see any on running as Regular User

Launch exe file
Start Logman (Admin level)
Run Bat File to Open Program
Bat File should run with regular user level priv's

I had a look at using RUNAS but that requires password entry, which I don't want. Is there some other way on windows to delevate?

SlightlyKosumi
  • 701
  • 2
  • 8
  • 24
  • 2
    There is [solution](https://stackoverflow.com/questions/53727582/). So use this command in your batch-file: `runas /trustlevel:0x20000 "%~f0"`. Where `"%~f0"` is the file-path of your batch. Can be replaced with `"logman.exe"` or any other command. – Daemon-5 Sep 23 '21 at 11:32
  • Thank you for this. I'm afraid that I didn't think to search on unelevate. I will try it now. – SlightlyKosumi Sep 23 '21 at 12:07

1 Answers1

0

you could use psexec

psexec -l powershell.exe -executionpolicy unrestricted -noexit -file c:\temp\checkelevated.ps1

-l : Run process as limited user (strips the Administrators group and allows only privileges assigned to the Users group). On Windows Vista the process runs with Low Integrity.