Getting IPConfig from Get-NetIPConfiguration

This topic is resolved

Share
Viewing 4 reply threads
  • Author
    Posts
    • #1554415
      PowerMe!
      Participant
      Post count: 24
      Member Points: 1,157
      Rank: Level 3

      I am trying to output basic IP config data for different interfaces on a host by

      It outputs the IP info not in the form I want – just IP addresses. My understanding is that it is outputting the relevant Objects as defined in the Select. I am missing a way to extract the strings from the above objects. Would appreciate an explanation on how to deal with it.

       

      On closer look:

       

      • This topic was modified 1 month, 1 week ago by PowerMe!.
      0
    • #1554419
      Leos Marek
      Moderator
      Post count: 133
      Member Points: 6,405
      Rank: Level 3

      You have to create your own property showing just the info you need, like this:

       

      2+

      Users who have liked this topic:

      • avatar
      • avatar
    • #1554420
      PowerMe!
      Participant
      Post count: 24
      Member Points: 1,157
      Rank: Level 3

      Thank you- that’s what I looking for- lost the reference to it! Would you mind explaining a bit more on that syntax? Is there a reference  can follow?

      @{…} you define an indexed array

      • I presume “l” is label
      • what’s “e” – I see that it has the property

      I ended up doing a similar but somewhat elaborate way by defining a custom array as below.

      This generates a bit of compact output but serves my purpose. But I liked your option as the output it much nicer. I will update my script, thanks again.

      In any case, this is part of a script that I made to dump basic information from a computer to text file which is used for troubleshooting AD, networking and application errors.

      • This reply was modified 1 month, 1 week ago by PowerMe!.
      1+
    • #1554433
      Leos Marek
      Moderator
      Post count: 133
      Member Points: 6,405
      Rank: Level 3

      As you say, l=label, e=expression. Its not about array. The @ is used to create the custom property, not related to array at all. You can basically put to expression whatever scriptblock you want.

      Here you have great explanation – https://4sysops.com/archives/add-a-calculated-property-with-select-object-in-powershell/

      1+

      Users who have liked this topic:

      • avatar
    • #1554434
      PowerMe!
      Participant
      Post count: 24
      Member Points: 1,157
      Rank: Level 3

      Ah, thank you so much, got it.

      0
Viewing 4 reply threads
  • You must be logged in to reply to this topic.
© 4sysops 2006 - 2020

CONTACT US

Please ask IT administration questions in the forums. Any other messages are welcome.

Sending

Log in with your credentials

or    

Forgot your details?

Create Account