Skip to main content

Notifications

Power Automate - Power Automate Desktop
Unanswered

Run application as admin

(0) ShareShare
ReportReport
Posted on by 178

Hi Guys,

 

Anyone know how to run a application from powerautomate desktop with admin rights.

 

Currently when i launch the software manually it prompts users to run as admin.

 

When running application from powerautomate desktop it doesnt run it as admin therefore program doesnt work.

 

Any help is greatly appreciated.

 

Thanks

  • davidptm56 Profile Picture
    davidptm56 4 on at
    Re: Run application as admin

    Hello @christian12 ,

     

    In case it helps,

    What I've done to run apps with elevated rights from an unelevated and unattended PAD(interaction with UAC is not an option, but I don't wanna disable it) is:

     

    1. Create a .bat file that calls the application I want to run.
    2. In my Desktop Flow add the step:  Run application 'C:\Windows\System32\cmd.exe' with arguments '/K "runas /noprofile /user:{myAdminUserName} {c:\...path to the bat file created in #1\batfile.bat}" && exit'. This invokes my bat file in a new cmd window with the window title 'C:\Windows\System32\cmd.exe - runas /noprofile /user:{myAdminUserName} {c:\...path to the bat file created in #1\batfile.bat}'. This is important to correctly identify the right cmd window in next step and don't accidentally leak admin password.
    3. Add step: Send Keys.
      1. Chose target for the sent keys by title or class.
      2. Window Title: see point #2.
      3. Window Class: 'ConsoleWindowClass'.
      4. Text to send:  encrypted text direct input. Insert your admin's password here. It'd be unreadable by any user after you save this step.
      5. I always chose send keys as hardware with delay between inputs = 1
    4. Add step: Send Keys.
      1. Target same windows as in step #3
      2. Text to send: '{return}'
    5. That's it. Add waits after if you need them before your flow continues.
  • momlo Profile Picture
    momlo 1,527 on at
    Re: Run application as admin

    @christian12 Note that you will need to run PAD with elevated permissions too. Otherwise, you will not be able to control the elevated app.

  • Nived_Nambiar Profile Picture
    Nived_Nambiar 17,105 on at
    Re: Run application as admin

    Hi @christian12 

     

    Could you try running this powershell script using Run Powershell script action, Then u can open the application 

    Pass path of application, adminusername, adminpassword in the respective variables as shown below 🙂

     

    $applicationPath = "C:\Program Files\MyApp.exe"
    $username = "Administrator"
    $password = "password" | ConvertTo-SecureString -AsPlainText -Force
    $credential = New-Object System.Management.Automation.PSCredential($username, $password)

    Start-Process -FilePath $applicationPath -Credential $credential -Verb runAs

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard