< Back

Get-HFMHostsfile

Tue Jan 14, 2020 1:37 am

NAME Get-HFMHostsfile



SYNOPSIS

Get the hosts file of the desired hostname.





SYNTAX

Get-HFMHostsfile [[-ComputerName] <String[]>] [<CommonParameters>]





DESCRIPTION

Get the hostfile of the desired hostname.

By default the localhost hosts file is fetched. You can specify a remote computer name.





PARAMETERS

-ComputerName <String[]>



Required? false

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

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 String.





OUTPUTS

Return [HostsFile] 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:\\>Get-HFMHostsfile



Return a [HostsFile] object representing the local hosts file.









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



PS C:\\>Get-HFMHostsfile -Name Computer1



Return a [HostsFile] object representing the hosts file of Computer1.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>"Computer1","Computer2" | Get-HFMHostsfile



Return an array of [HostsFile] objects representing the hosts file of Computer1 and Computer2.











RELATED LINKS