< Back

Reset-CHostsFile

Sun Jan 12, 2020 10:56 pm

NAME Reset-CHostsFile



SYNOPSIS

Removes all custom host entries from this computer's hosts file.





SYNTAX

Reset-CHostsFile [[-Path] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]





DESCRIPTION

Sometimes you want to start over. This method removes all hosts entries from your hosts file after the default

localhost entry.



By default, the current computer's hosts file is reset. You can operate on a custom hosts file by passing its

path to the `Path` argument.





PARAMETERS

-Path <String>

The path to the hosts file to modify. Defaults to the local computer's hosts file.



Required? false

Position? 1

Default value (Get-CPathToHostsFile)

Accept pipeline input? false

Accept wildcard characters? false



-WhatIf [<SwitchParameter>]



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Confirm [<SwitchParameter>]



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:\\>Reset-CHostsFile



If your hosts file contains something like this:



127.0.0.1 localhost

10.1.2.3 myserver

10.5.6.7 myserver2



After calling `Reset-CHostsFile`, your hosts will contain:



127.0.0.1 localhost









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



PS C:\\>Reset-CHostsFile -Path my\\custom\\hosts



Resets the hosts file at `my\\custom\\hosts`.











RELATED LINKS