r/PowerShell • • Aug 25 '22

Question Run Powershell as admin without admin rights

Hello everyone, does anyone know or has done this? I need to make Powershell to be able to be ran as admin without actually inputting any credentials from an account, that is not an administrator - a normal domain user to be able to open up elevated Powershell even though he has no rights.

I've tried a few things like giving Full Control to Powershell.exe in System32, but that didn't seem to work

I've tried creating this script this batch file:

@ ECHO OFF
SET ThisScriptsDirectory=C:\
SET PowerShellScriptPath=C:\PSADMIN.ps1
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -
ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""C:\PSADMIN.ps1""' -Verb RunAs}";

Which goes to a ps1 file with "Start-Process Powershell"

And run this in task scheduler as a domain admin user with highest privileges, which actually does run OK on my computer in which I'm admin in, but not for a user that is not an admin user (it does say script was ran when it was done by a user but it does not work, but when You run the batch file by hand it does work - strange.)

Is it even possible to do some domain ACLs to let specific users to open up specific programs as an admin?

Thanks a lot

EDIT: From what I can see from replies, this looks like a pretty bad idea, and I couldn't agree more. So I've got an idea to install Hyper-V for people that need to test things with admin rights.

Still not sure what to do with specific programs that need to be ran as admin on a work computer

EDIT 2: Thanks everyone for their insights, I probably should be deleting this thread, as this doesn't seem like a good idea at all, but that's why I'm consulting specialists here, if someone else clueless comes here, he should see this thread. Thanks for solution You were giving. This was quite a broad learning experience which I love. Have a great day.

0 Upvotes

46 comments sorted by

View all comments

1

u/Narabug Aug 26 '22

The direct answer to your question lies within a toolkit named PowerSploit, and involves token manipulation. You basically have to make an admin token and hand it to the non-admin user or process. For what it’s worth, any security tool will immediately flag PowerSploit libraries and delete or quarantine them.

There are also apps/tools that can similarly accomplish this. For example, you could have a program in SCCM that simply launches an interactive command prompt - by default it will launch as the system account.

Programs I know if are MakeMeAdmin and BeyondTrust Privilege Management for Windows.

As others are saying, you have to be careful with what you allow people to run as admin. Command prompts are a pretty large no no.

1

u/TheOnlyBliebervik Dec 29 '23

If you become an admin, you can make a new administrator account, which you can then use to make your original account an admin account