en-US/about_xHostsFile.help.txt
.NAME
xHostsFile # Description This resource is used to control entries on a the host file for a node. .PARAMETER HostName Key - string Specifies the name of the computer that will be mapped to an IP address. .PARAMETER IPAddress Write - string Specifies the IP Address that should be mapped to the host name. .PARAMETER Ensure Write - string Allowed values: Present, Absent Specifies if the hosts file entry should be created or deleted. .EXAMPLE Add a new host to the host file Configuration Example { param ( [Parameter()] [System.String[]] $NodeName = 'localhost' ) Import-DSCResource -ModuleName xNetworking Node $NodeName { xHostsFile HostEntry { HostName = 'Host01' IPAddress = '192.168.0.1' Ensure = 'Present' } } } .EXAMPLE Remove a host from the hosts file Configuration Example { param ( [Parameter()] [System.String[]] $NodeName = 'localhost' ) Import-DSCResource -ModuleName xNetworking Node $NodeName { xHostsFile HostEntry { HostName = 'Host01' IPAddress = '192.168.0.1' Ensure = 'Absent' } } } |