Blog Post

Running Powershell scripts remotely.

,

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:

PoSHPermissions

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.

Filed under: Powershell, SQLServerPedia Syndication Tagged: Powershell, security

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating