0

We have many solutions which opens the PowerShell in elevated mode using self-elevating batch file, self-elevating PowerShell Scripts as well.

But My question is how do we open PowerShell in elevated mode using PowerShell without any admin prompt.

Basically all the solutions given to this question help us open in admin mode, but there we need to press okay on the prompt.

Is there any way to disable the prompt using PowerShell itself?

Community
  • 1
  • 1
Chetan Kulkarni
  • 404
  • 4
  • 15
  • No. You need to change the UAC security policies to elevate without prompting. – Ansgar Wiechers May 05 '17 at 10:24
  • You can change UAC which will stop the prompt for all programs, but there is no way to only stop the prompt for a single application (Powershell in this case) – henrycarteruk May 05 '17 at 10:25
  • @JamesC. Since they only need to press OK they're apparently running the scripts from admin accounts, so AFAICS disabling running administrators in admin approval mode should suffice. But either way, like you said: changing the setting affects all applications, not just particular ones. – Ansgar Wiechers May 05 '17 at 10:35
  • Can we Change UAC with powershell,And Change it back to normal mode after the execution of the script – Chetan Kulkarni May 05 '17 at 10:37
  • Check this: https://gallery.technet.microsoft.com/How-to-switch-UAC-level-0ac3ea11 – degant May 05 '17 at 10:45
  • 1
    Changing UAC policies requires a reboot. – Ansgar Wiechers May 05 '17 at 11:04
  • Are these scripts interactive? Do they need to be run by individuals? Could you not role these into scheduled tasks that can be run on demand? Those could be configured to run elevated without prompting (once credentials are saved).... you might even be able to get those to fire in scripts without the prompt... never had a reason to try. – Matt May 05 '17 at 11:29
  • @degant Your Solution Helped me Achieve the Task!Thank You – Chetan Kulkarni May 05 '17 at 12:07

0 Answers0