Invoke-Command and elevated privilege

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of Craig Stevens Craig Stevens 1 year, 3 months ago.

  • Author
  • #35800
    Profile photo of Craig Stevens
    Craig Stevens

    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 ?

  • #35802
    Profile photo of Wei-Yen Tan
    Wei-Yen Tan

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

  • #35805
    Profile photo of Dave Wyatt
    Dave Wyatt

    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:

  • #36890
    Profile photo of Craig Stevens
    Craig Stevens

    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.

You must be logged in to reply to this topic.