Running a PS script in batch file, disable UAC?

Welcome Forums General PowerShell Q&A Running a PS script in batch file, disable UAC?

This topic contains 1 reply, has 2 voices, and was last updated by

4 years, 8 months ago.

  • Author
  • #14912

    Points: 31
    Rank: Member

    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?

  • #14913

    Points: 1,785
    Helping HandTeam Member
    Rank: Community Hero

    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?

The topic ‘Running a PS script in batch file, disable UAC?’ is closed to new replies.