PS C:\> ipconfig | # do raw filtering to only get lines with this word Where-Object { $_-like'*IPv4*' } | # do RegEx filtering to identify the value matching the pattern Where-Object { $_-match'\b(?:\d{1,3}\.){3}\d{1,3}\b' } | # return the results from -match which show in $matches Foreach-Object { $matches[0] }