Get-NetConnectionProfile how to use a piped where command?

Welcome Forums General PowerShell Q&A Get-NetConnectionProfile how to use a piped where command?

Viewing 2 reply threads
  • Author
    Posts
    • #233335
      Participant
      Topics: 2
      Replies: 2
      Points: 33
      Rank: Member

      Hi all

      Get-NetConnectionProfile

      This lists multiple connections.

      What command can I use to give me the results for just the below connection ie

      if the InterfaceAlias is “Tunnel” and the Name is “mydomain.uk”   ?

      Name : mydomain.uk
      InterfaceAlias : Tunnel
      InterfaceIndex : 87
      NetworkCategory : DomainAuthenticated
      IPv4Connectivity : Internet
      IPv6Connectivity : NoTraffic

      I’ve tried a piped where -match – like -eq, I’m getting the syntax wrong somewhere.

      Thanks for any info.

    • #233395
      Participant
      Topics: 5
      Replies: 2384
      Points: 6,066
      Helping Hand
      Rank: Community MVP

      John

      When you post code, error messages, sample data or console output format it as code, please.
      In the “Text” view you can use the code tags “PRE“, in the “Visual” view you can use the format template “Preformatted“. You can go back edit your post and fix the formatting – you don’t have to create a new one.
      Thanks in advance.

      Please take a look at the cmdlet Where-Object. Please read the complete help including the examples to learn how to use it.

      If you have problems with your code you should share this code here completely including the error messages you might get.

    • #233428
      js
      Participant
      Topics: 31
      Replies: 829
      Points: 2,572
      Helping Hand
      Rank: Community Hero

      With “-and” you have to go the scriptblock form:

      | where { $_.InterfaceAlias -eq 'Tunnel' -and $_.Name -eq 'mydomain.uk' }
      • This reply was modified 1 month, 1 week ago by js.
Viewing 2 reply threads
  • You must be logged in to reply to this topic.