Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I make PowerShell run a program as a standard user?

Tags:

powershell

Alright, so, I've been searching online forever, and I can't find anything on this at all.

Basically, what I want to do is run a program from an elevated PowerShell script, but I want the program to run as the standard user.

I need to do this because the program that I need to run requires access to a mapped network drive that the domain administrator accounts don't have access to. So, I basically need a line of code that will take the script out of elevated mode, or some extension to the Start-Program command that will make it run as the logged on user rather than the administrator account that the script is running from.

like image 899
crimsonnin2 Avatar asked Nov 01 '25 15:11

crimsonnin2


1 Answers

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.

like image 115
Loïc MICHEL Avatar answered Nov 03 '25 20:11

Loïc MICHEL



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!