Invoke-Command and elevated privilege

Welcome Forums General PowerShell Q&A Invoke-Command and elevated privilege

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
2 years, 8 months ago.

  • Author
    Posts
  • #35800

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 1
    Rank: Member

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

  • #35805

    Member
    Points: 0
    Rank: Member

    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:

    https://support.microsoft.com/en-us/kb/942817

  • #36890

    Participant
    Points: 0
    Rank: Member

    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.

The topic ‘Invoke-Command and elevated privilege’ is closed to new replies.