Created
March 8, 2018 05:05
-
-
Save joncloud/381cb04a7243829c8d5060a4092d9410 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $Expression = [regex] '^([^\s#]*)\s*([^\s#]*)\s*(#.*|)$' | |
| Get-Content $env:windir\system32\Drivers\etc\services ` | |
| | ForEach-Object { $Expression.Match($_) } ` | |
| | ForEach-Object { | |
| @{ | |
| Name = $_.Groups[1].Value; | |
| Port = $_.Groups[2].Value; | |
| Comment = $_.Groups[3].Value | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment