to enable psremoting on network computers

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of Srikanth Byram Srikanth Byram 1 year, 2 months ago.

  • Author
    Posts
  • #31624
    Profile photo of Srikanth Byram
    Srikanth Byram
    Participant

    hi friends,

    am looking for a ps script to enable psremoting on network computers using pstools .

    below is my script

    but this didn't work as this enable only the first computer starts with hostname "pndt0001"

    $computers=Get-ADComputer -filter 'name -like "pndt000*"'|select -ExpandProperty name
    foreach ($computer in $computers)
    {C:\PSTools\PsExec.exe \\$computer -s powershell Enable-PSRemoting -force}

    am looking for script which first should test the connections to listed computers and then pass tested connection machines to execute the command by filtering not connected machines.

    thanks

  • #31638
    Profile photo of Flynn Bundy
    Flynn Bundy
    Participant

    Hi Srikanth,

    Going to ask a bit of an obvious question here.

    Why not use Group Policy to enable PSRemoting?
    Chances are this day and age if you hear to word 'Psexec' its probably not the best way to do it.

  • #31652
    Profile photo of Wilfredo Perez
    Wilfredo Perez
    Participant

    I agree with Flynn, GPO is the way to go.

  • #31659
    Profile photo of Srikanth Byram
    Srikanth Byram
    Participant

    hi Flynn,

    i was aware of this option doing via GPO but we have very limit scope on AD given to us (i hope that you got my point now) .

    we have around 300 machines in our organisation after researching for days i found this option of doing via Psexec and can able to do it for single machine at one time .

    i need a script for enabling psremoting for multiple machine at one time .

You must be logged in to reply to this topic.