< Back

Hosts

Sat Jan 18, 2020 8:19 pm

NAME Hosts



SYNOPSIS

The hosts commands allows you to control the hosts file





SYNTAX

Hosts [-Action] <String> [[-Value1] <String[]>] [[-Value2] <String[]>] [-HostsPath <String>] [-Environment

<String>] [-Credentials <PSCredential>] [<CommonParameters>]





DESCRIPTION

The hosts commands allows you to control the hosts file, by adding/removing entries; as well enabling/disabling

them.



Hosts also supports profiles, so you can have a developer hosts file in your repo and import/merge it for

developers.



You can also test the entries by pinging them, either using the normal ping or by passing specific ports.





PARAMETERS

-Action <String>



Required? true

Position? 1

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Value1 <String[]>



Required? false

Position? 2

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Value2 <String[]>



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



-HostsPath <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Environment <String>



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Credentials <PSCredential>



Required? false

Position? named

Default value

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



OUTPUTS



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



PS C:\\>hosts add 127.0.0.3 dev.test.local













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



PS C:\\>hosts export ./local.hosts













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



PS C:\\>hosts test *.local 80, 443













-------------------------- EXAMPLE 4 --------------------------



PS C:\\>hosts list -e dev















RELATED LINKS