Share via

another "where-object -contains" powershell question

Chodziński Bartosz SPIE 21 Reputation points
2021-01-25T12:15:23.98+00:00

Get-DhcpServerv4Lease -ScopeId 10.40.0.0 | Where-Object ClientId -Contains "0"
Why it return 0 values? I have hundres of Mac Addresses which contain zero "0", no matter if I press "[asterisk]0[asterisk]" or anything else, contain return null output.
I don't understand even though I've read so many examples...
How to search through results?

Windows for business | Windows Server | User experience | PowerShell

Answer accepted by question author

Andreas Baumgarten 132K Reputation points MVP Volunteer Moderator
2021-01-25T12:30:54.76+00:00

Could you please try -match instead of -contains and see if this will work.


(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

Regards
Andreas Baumgarten

Was this answer helpful?

0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Chodziński Bartosz SPIE 21 Reputation points
    2021-01-25T13:15:28.77+00:00

    Thank you, thank you, thank you!

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.