< Back

Remove-GCHostsFileEntry

Mon Jan 13, 2020 8:06 pm

NAME Remove-GCHostsFileEntry



SYNOPSIS

Remove a hosts file entry from the hosts file.





SYNTAX

Remove-GCHostsFileEntry [-Target] <String[]> [<CommonParameters>]





DESCRIPTION

Unlike the other hosts file cmdlets, this function is a

simple line match and remove.



Type 'Get-Help Remove-GCHostsFileEntry -Online' for extra information.





PARAMETERS

-Target <String[]>

The search string to remove from the hosts file.

Regular expressions are supported.



Required? true

Position? 1

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

System.Int32





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



PS C:\\>The following example removes any lines in the hosts file



that match the target string:



Remove-GCHostFileEntry -Target "abc.net.au"









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



PS C:\\>The following example will remove all empty lines from



the hosts file:



Remove-GCHostsFileEntry -Target '^$'











RELATED LINKS