Tuesday, March 5, 2013

Access Denied when executing remote powershell

It's been a while since I've posted anything here, and I need to get back into the habit of adding to this blog as issues arise.

When trying to remotely run a PowerShell script you may find that you need local administrator access to the remote computer to successfully run the script. If not properly configured, you will receive an access denied message. A simple fix would be to add the user running the script to the local Administrators group, but we don't necessarily want to grant them this level of access.

If you haven't already done so, you must enable PowerShell remoting. This is done by running this command in PowerShell: Enable-PSRemoting on the remote computer. For more info on this command go to this technet link: Enable PSRemoting

Next you need to run this PowerShell command:
Set-PSSessionConfiguration -Name Microsoft.PowerShell -showSecurityDescriptorUI

Confirm that you want to perform this, it will then open a window allowing you to add users/groups with the appropriate permissions. You should now be able to remotely run your PowerShell scripts.

Note: This can impose security risks to your system, so please use this at your own discretion.

For additional information you may reference this page: PowerShell Blog

No comments: