SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

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:


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


My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.


Leave a comment on the original post [sqlstudies.com, opens in a new window]

Loading comments...