Best Practice: Remote Commands

Welcome Forums General PowerShell Q&A Best Practice: Remote Commands

This topic contains 3 replies, has 3 voices, and was last updated by

 
Participant
1 year, 1 month ago.

  • Author
    Posts
  • #93535

    Participant
    Points: 1
    Rank: Member

    Is there a best practice for running cmdlets against a remote computer?

    For example:

    Get-NetAdapter -CimSession $Session ...
    Invoke-Command -ComputerName $Session -Scriptblock { Get-NetAdapter }

    Is either of these "better" than the other, or does it come down to personal preference?

    Thanks,
    Des

  • #93579

    Keymaster
    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    Those use slightly different protocols. Aside from that, the former doesn't work in Core, I don't think.

    • #93588
      js

      Participant
      Points: 743
      Helping Hand
      Rank: Major Contributor

      Core has new-cimsession (windows only). Core doesn't have get-netadapter.

  • #93589

    Participant
    Points: 1
    Rank: Member

    Thanks. Going to rework a few modules to use only the ICM then.

The topic ‘Best Practice: Remote Commands’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort