Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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
}
share|improve this answer
    
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. –  user1399195 Aug 29 '12 at 21:57
    
nevermind, got it to work with PDQ Deploy. Didn't realize it'd be that easy. Thanks! –  user1399195 Aug 29 '12 at 22:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.