How can I bypass Windows 11 UAC for my PowerShell scripts?

0
44
Asked By CuriousCat99 On

I'm currently working on a setup in Windows 10 where a scheduled task triggers a Node.js script that downloads and executes a PowerShell script tailored for each user. However, I've hit a snag with Windows 11, as the User Account Control (UAC) blocks the PowerShell script from executing automatically; it requires user interaction to proceed. I've thought about disabling UAC altogether, but that affects all users on the machine, which isn't ideal. I'm considering another approach: having the Node.js script download the PowerShell script locally and then set up a second scheduled task to run it with admin rights after a brief delay. The hurdle here is that the PowerShell script needs a unique name for each user. Any advice or alternative solutions would be greatly appreciated!

5 Answers

Answered By ScriptSleuth42 On

It sounds like a pretty complex setup, and honestly, it might be worth reevaluating why you need to go through all this trouble. Have you considered whether your end goal can be achieved in a simpler way? From a security perspective, your method of scheduled tasks and elevated scripts is similar to tactics used by malware, which could trigger security alerts even if you solve the UAC issue.

Answered By PowershellNinja17 On

Instead of using a Node.js script to fetch the PowerShell script, couldn't you just use a PowerShell script to do that? It would streamline your process and might help you avoid some of the hurdles you're hitting with UAC.

Answered By CuriousCat99 On

Haha, I wonder if this is an X;Y problem... Seems like it could be!

Answered By TechieTim123 On

What is the main purpose behind running these scripts? Clarifying that might lead us to better solutions.

Answered By AdminWhiz503 On

You could look into getting rid of the need for admin rights entirely. One way to do this is by impersonating the user using the SYSTEM account, which could help you work around the UAC restrictions. I don't have the PowerShell code at hand right now, but that could be one avenue to explore.

UserExperiments74 -

Are you suggesting this method works only for local users and not those on a domain?

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.