How to use psexec to start installation or other task that requires UAC interaction?

I'm trying to remotely start installations and I'd like not to disable UAC. If I start the processes remotely using psexec, the installer will just get stalled waiting for the UAC prompt. Other tasks such as temporary files cleaning, services restarting, etc, will get me Access Denied errors. Is there anyway psexec can walk around UAC such as logging in with Administrator but with the TrustedInstaller privileges or something like that?

By the way, I'm targeting Windows 2008 R2, but I think this question applies to Vista, 2008 and Windows 7 as well.


You need to use the -u option and specify an account that has local admin access to that machine (a local account, domain admin account etc)

 -u         Specifies optional user name for login to remote
            computer.

For example

psexec \\pc999.myDomain.loc -u pc999\Administrator <your exe>


The -h parameter is key here: without it, psexec does not not execute the command with UAC elevated privileges on Windows Vista and above:

C:\Users\merickson>psexec /?

PsExec v1.97 - Execute processes remotely
Copyright (C) 2001-2009 Mark Russinovich
Sysinternals - www.sysinternals.com

PsExec executes a program on a remote system, where remotely executed console
applications execute interactively.

Usage: psexec [\\computer[,computer2[,...] | @file]][-u user [-p psswd]
 [-n s][-l][-s|-e][x][-i [session]][-c [-f|-v]][-w directory][-d][-<priority>]
 [-a n,n,...] cmd [arguments]

...

 -h         If the target system is Vista or higher, has the process
            run with the account's elevated token, if available.
...

(edit: added evidence of -h switch's existence, per comment below)