0

First off: This is not a duplicate of How to remote execute an ELEVATED remote script in PowerShell.

My scenario is similar but different in a certain way. What I want to do is the following:

Invoke-Command -UseSSL -ComputerName "$COMPUTER" -FilePath \\script.example.com\secretshare$\install_test.ps1 -ArgumentList 'U'

As the called script performs an installation and manipulates firewall rules, it needs elevated privileges. Irritatingly the error I get is an access error on the share mentioned above.

When I use this suggestion where I use PowerShell DSC, which is run as SYSTEM, it works. But only on Servers running Windows Management Framwork 4.0. So obviously I need a solution for Windows Server 2008 (R2) systems.

I hope someone can point me to the right direction so I can update this question to help other admins aswell.

Thorian93
  • 252
  • 3
  • 12
  • My usual recommendation is: disable UAC (at least on servers). In centrally managed environments it does more harm than good in my experience. – Ansgar Wiechers Jul 19 '17 at 12:19
  • Can you post your error? I suspect you are having a CredSSP issue but will need to see your error to know for sure. – Ty Savercool Jul 19 '17 at 13:31
  • You are right I am afraid. I get an access denied or location not found error respectively. I taked to our security guys and we are now looking into enabling CredSSP for our Windows servers. Anyways, can you answer the question in general on how to launch an elevated remote powershell session on a server? I think many would benefit from that as I could not find proper ressources on that. – Thorian93 Jul 20 '17 at 13:09

0 Answers0