Thorian93
Thorian93

Reputation: 312

How to remotely execute an remote script in PowerShell

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.

Upvotes: 0

Views: 490

Answers (0)

Related Questions