Run powershell script from cmd.exe as admin RRS feed

  • General discussion

  • Hello,

    Is there a way to run a powershell script as admin from cmd.exe

    I am missing the store app on many of my user's.

    I am attempting to have cmd.exe call my powershell script whent he machine boots.

    The problem is, is that PS is asking for admin rights when you run the following command from cmd.exe

    Note: My startup command* has many different tasks it performs on 1st boot.

    I have the line calling PS, but I get prompted with UAC when attempting to run (non-admin).

    PowerShell.exe -NoProfile -ExecutionPolicy Unrestricted -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Unrestricted -File ""c:\store_install.ps1""' -Verb RunAs}";

    Please advise. Thanks

    • Edited by vs2017sv Friday, July 19, 2019 7:25 PM
    • Changed type Bill_Stewart Thursday, September 5, 2019 9:44 PM
    • Moved by Bill_Stewart Thursday, September 5, 2019 9:45 PM No - you cannot bypass the UAC prompt
    Friday, July 19, 2019 3:56 PM

All replies

  • PowerShell cannot be automatically elevated.

    What is "Mycmd.exe".  It is not a Windows program?

    You cannot bypass UAE.


    Friday, July 19, 2019 6:48 PM
  • Typo*.

    So you can not elevate powershell via cmd.exe and a non-admin user.


    Friday, July 19, 2019 7:25 PM
  • You cannot avoid the UAE prompt.

    You can start a console using "RunAs" and supply admin credentials but you will still get the prompt asking for elevation.

    You can use Group Policy and a startup script to run many installers at system startup.

    I suggest that you should take some time to learn basic Windows and how it works at a technical level.  What users learn does not cover the details of system security and bootstrapping a system.  There are many books available that will help you to learn this.


    Friday, July 19, 2019 7:53 PM
  • This is such a common question that we created a "sticky" post for it. It's right at the top of the forum. Please read this first:

    You cannot bypass the UAC prompt

    -- Bill Stewart [Bill_Stewart]

    Saturday, July 20, 2019 4:04 PM