Running a PS script in batch file, disable UAC?

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Don Jones Don Jones 2 years, 7 months ago.

  • Author
    Posts
  • #14912
    Profile photo of bvi1998 .
    bvi1998 .
    Participant

    Hi,
    I am trying to run the following command from a batch file:
    PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -windowstyle hidden -ExecutionPolicy Bypass -File script.ps1' -Verb RunAs}";
    This will be run during an automated server deployment. When I run it manually I get the UAC prompt. Obviously the UAC is not something I want to turn off, unless it's part of the batch file and I can turn it back on. Can someone help me with this?
    Thanks!

  • #14913
    Profile photo of Don Jones
    Don Jones
    Keymaster

    So, there's not a way to stop UAC from doing what it does, short of turning it off. Because you're trying to run a process that triggers UAC, I'm not sure you could turn it off as PART of that process. But on a server, would you normally have UAC enabled?

You must be logged in to reply to this topic.