2

I have a Powershell script that opens another program and my overall goal is to run these under a currentuser account, rather than a system account. For now I have the following.

The below works well however, it opens a "user account control" popup which I'm trying to avoid. Any suggestions would be greatly appreciated.

override wait
hidden=true
Completion=process
runas=currentuser
wait powershell.exe /C "C:\Drivers\OEM\Setup\examplescript.ps1" /SILENT /SP /Norestart

I've tried changing the silent switches within the PowerShell script that opens the HPImageAssistant tool but that did not work.

mklement0
  • 382,024
  • 64
  • 607
  • 775
kav
  • 23
  • 2
  • The only way to avoid [UAC](https://en.wikipedia.org/wiki/User_Account_Control) prompts is to either run in an elevated process to begin with or to disable UAC altogether, _which is strongly discouraged_. Otherwise, there's only a limited workaround: Assuming that you are an administrator in principle, you can set up a scheduled task with a preconfigured command to be run with elevation, which you can then invoke on demand from a non-elevated session of yours without triggering a UAC prompt (see [this answer](https://stackoverflow.com/a/50555081/45375) for details). – mklement0 Aug 18 '23 at 13:50
  • 1
    This makes perfect sense, thanks! – kav Aug 18 '23 at 15:17
  • Glad to hear it, @kav. I've closed your question as a duplicate, as the linked post contains the same information as my comment. – mklement0 Aug 18 '23 at 15:21

0 Answers0