Running Powershell scripts remotely.


April 29, 2015 by Kenneth Fisher

I’ve only recently started to play with Powershell (PoSH) but even I’ve begun to discover what a huge number of tasks it can perform. Currently I’m working on a task to run SSIS packages remotely by using Invoke-Command to run DTEXEC on a remote machine. I’ll be posting the final script later, once I have it working 100%. I’m currently still having a few permissions issues.

My first problem though was to set things up so that I can run my scripts remotely. It turns out that if you are an administrator on the remote box there are no problems. (As you might expect.) However if the account that will be running the scripts is not a member of the administrator group some additional work is required. Not much admittedly, but it will still throw you if you don’t get it done.

First here is the error you will get:

Access is denied. For more information, see the about_Remote_Troubleshooting Help topic.

In order to set yourself up run the following script on the remote server:

Set-PSSessionConfiguration -Name Microsoft.PowerShell `
      -ShowSecurityDescriptorUI -Force

This will bring up a screen like this:


From here you can add or remove users and grant them the required permissions for running PoSH remotely.

A better idea is to have an AD group created, add whatever users need the access and then grant it the permissions. That way in the future all you have to do is have new users/service accounts added to the AD group.

Of course this just allows you to run the PoSH script. It doesn’t grant any additional permissions required for the script to actually do anything.

2 thoughts on “Running Powershell scripts remotely.

  1. Thomas says:

    You can also use to run PowerShell scripts remotely from your phone or tablet

  2. […] SQL Server use? TSQL – Change Data Capture Approaches to deploying Sql Server database code Running Powershell scripts remotely. Understanding break, continue, return, and exit The pain of Simple Parameterization in SQL Server […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 3,755 other subscribers

Follow me on Twitter

ToadWorld Pro of the Month November 2013
%d bloggers like this: