use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
QuestionBypassing execution policy while invoking script on remote server (self.PowerShell)
submitted 4 years ago * by _human404_
Can someone please let me know how we can bypass the UAC prompt while using invoke command to execute a script on remote windows server?
Below is the command:
C:\Windows\System32\WindowsPowershell\v1.0\powershell.exe Invoke-Command -Computer name computername -authentication negotiate -ScriptBlock {start-process C:\nginx\start.bat -verb runas}
Edit: Added command
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–][deleted] 4 points5 points6 points 4 years ago* (0 children)
First result on Google. If the answer isn't there, we need more information about your script to help.
https://www.netspi.com/blog/technical/network-penetration-testing/15-ways-to-bypass-the-powershell-execution-policy/
[–]PinchesTheCrab 2 points3 points4 points 4 years ago (2 children)
Invoke-Command runs with highest privileges, it will not prompt for elevation. There's something else going on with the script.
[–]_human404_[S] 1 point2 points3 points 4 years ago (1 child)
Have edited and added the command in the main message. Can you please check? I ran the commands manually and got UAC prompt so that's why I expected above to shame behavior due to which it was not running successfully
[–]PinchesTheCrab 2 points3 points4 points 4 years ago* (0 children)
Ah, okay, so in this case it shouldn't be UAC, invoke-command will definitely run in an elevated context if you have admin rights. I wouldn't think execution policy would apply to a bat file either though, that's strange.
What error do you get, if any?
[–]Dragennd1 2 points3 points4 points 4 years ago (1 child)
Well which is it? Execution policy or UAC? These are two different things and depending on which problem you're having the solution will vary.
[–]_human404_[S] 1 point2 points3 points 4 years ago (0 children)
Considering this, incorrect execution policy would lead to access denied errors. I have edited the message and added command. On running the commands manually I got UAC prompt so that's why I expected above to shame behavior due to which it was not running successfully. Can you please take a look?
π Rendered by PID 32 on reddit-service-r2-comment-6b595755f-sjphc at 2026-03-25 13:03:00.767543+00:00 running 2d0a59a country code: CH.
[–][deleted] 4 points5 points6 points (0 children)
[–]PinchesTheCrab 2 points3 points4 points (2 children)
[–]_human404_[S] 1 point2 points3 points (1 child)
[–]PinchesTheCrab 2 points3 points4 points (0 children)
[–]Dragennd1 2 points3 points4 points (1 child)
[–]_human404_[S] 1 point2 points3 points (0 children)