Invoke-Command and elevated privilege

I’ve got an app (sefautil.exe for Microsoft Lync) that will only run as an administrator. I’m trying to call the app from another machine using invoke command. It works ok, but unless the app is running ‘as an administrator’ it doesn’t work.

How can I get invoke command to run something on a remote computer with the ‘run as administrator’ switched on ?

Short of running the console / ise as administrator mode you could try using the credential parameter and plug in an administrator account.

When you’re connecting to a remote computer, running “as administrator” should be automatic, unless you’re connecting with a local account on that remote computer. By default, that doesn’t work, but there’s a registry setting that you can configure to enable remote admin access for local accounts:

I managed to get this working by creating a script on the server with the seafutil. After that I created another script on my machine that creates a scheduled task on the server with the ‘run level’ highest set (Run as administrator) ( Register-ScheduledTask -Action $action -Trigger $trigger -User $user -Password $Password -TaskName “ForwardPhone” -Description "Forward Phone calls for $Number_param " -RunLevel Highest
Once it creates the task, it then runs it once and then deletes it.

A bit messy but at least it works.