1

I have some computers I'm trying to remotely execute powershell commands but I'm running into some snags. For one thing, the computers do not have Enable-PSRemoting enabled so I am unable to simply Enter-PSSession. I tried to run a powershell script through psexec but I have yet to Set-Execution Policy on the machine.

My thoughts were to execute a powershell logon script that accomplished this but before I tried this I was going to see if there were any other methods to enable-psremoting on a machine. Thanks in advance!

1 Answer 1

2

You do not need script for that. :) Here is a little wrapper function I use for exactly that purpose:

function Enable-Remoting {
param (
    [Alias('CN')]
    $ComputerName
)
    psexec \\$ComputerName -s -h -d powershell Enable-PSRemoting -Force
}
2
  • Is there a way to avoid using psexec? In order to accomplish most of my remoting needs I use PDQ Deploy because the antivirus solution that is deployed blocks psexec.
    – benfogel
    Aug 29, 2012 at 21:57
  • nevermind, got it to work with PDQ Deploy. Didn't realize it'd be that easy. Thanks!
    – benfogel
    Aug 29, 2012 at 22:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .