< Back
Remove-CHostsEntry
Post
NAME Remove-CHostsEntry
SYNOPSIS
Removes entries from the hosts file by hostname.
SYNTAX
Remove-CHostsEntry [-HostName] <String[]> [-Path <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
You can remove multiple entries or pipe entries into this function.
PARAMETERS
-HostName <String[]>
The hostname of the hosts entry/entries to remove.
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-Path <String>
The hosts file to modify. Defaults to the Windows hosts file.
Required? false
Position? named
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:\\>Remove-CHostsEntry -HostName 'adadvisor.net'
Demonstrates how to remove hosts entry for `adadvisor.net`, which you probably don't want to do.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Remove-CHostsEntry -HostName 'adadvisor.net','www.adchimp.com'
Demonstrates how to remove multiple hosts entries.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>('adadvisor.net','www.adchimp.com') | Remove-CHostsEntry
Demonstrates how to pipe hostnames into `Remove-CHostsEntry`.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Remove-CHostsEntry -HostName 'adadvisor.net' -Path 'C:\\Projects\\Carbon\\adblockhosts'
Demonstrates how to work with a file other than Windows' default hosts file.
RELATED LINKS
Name : Remove-IisMimeMap
Category : Alias
Synopsis : Remove-CIisMimeMap
Component :
Role :
Functionality :
SYNOPSIS
Removes entries from the hosts file by hostname.
SYNTAX
Remove-CHostsEntry [-HostName] <String[]> [-Path <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
DESCRIPTION
You can remove multiple entries or pipe entries into this function.
PARAMETERS
-HostName <String[]>
The hostname of the hosts entry/entries to remove.
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters? false
-Path <String>
The hosts file to modify. Defaults to the Windows hosts file.
Required? false
Position? named
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:\\>Remove-CHostsEntry -HostName 'adadvisor.net'
Demonstrates how to remove hosts entry for `adadvisor.net`, which you probably don't want to do.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Remove-CHostsEntry -HostName 'adadvisor.net','www.adchimp.com'
Demonstrates how to remove multiple hosts entries.
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>('adadvisor.net','www.adchimp.com') | Remove-CHostsEntry
Demonstrates how to pipe hostnames into `Remove-CHostsEntry`.
-------------------------- EXAMPLE 4 --------------------------
PS C:\\>Remove-CHostsEntry -HostName 'adadvisor.net' -Path 'C:\\Projects\\Carbon\\adblockhosts'
Demonstrates how to work with a file other than Windows' default hosts file.
RELATED LINKS
Name : Remove-IisMimeMap
Category : Alias
Synopsis : Remove-CIisMimeMap
Component :
Role :
Functionality :