< Back

Get-HFMHostsFileContent

Tue Jan 14, 2020 1:37 am

NAME Get-HFMHostsFileContent



SYNOPSIS

Read the Host file content.





SYNTAX

Get-HFMHostsFileContent [[-Path] <HostsFile[]>] [-ExcludeComments] [<CommonParameters>]





DESCRIPTION

Read the Host file content. Take input from Get-HFMHostsFile.





PARAMETERS

-Path <HostsFile[]>



Required? false

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-ExcludeComments [<SwitchParameter>]



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

Input must be of type [HostsFile].





OUTPUTS

Return [HostsEntry] Object(s).





NOTES





This cmdlet uses Class.HostsManagement classes, by @StephaneVG

Fork hist project if you like it: https://github.com/Stephanevg/Class.HostsManagement

Visit his site, and read his article a boute pratical use of PowerShell Classes:

http://powershelldistrict.com/powershell-class/



-------------------------- EXAMPLE 1 --------------------------



PS C:\\>$a = Get-HFMHostsFile



PS C:\\> Get-HFMHostsFileContent -Path $a

Use Get-HFMHostsFile to get a [HostsFile] object

Use Get-HFMHostFileContent to return a [HostsEntry] object(s)









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Get-HFMHostsFile | Get-HFMHostsFileContent -ExcludeComments



List HostsFile entrie, but exclude comments











RELATED LINKS