Returns the hostname from a DNS request
Get-Hostname [[-ip] <String>] [<CommonParameters>]
Returns the hostname from a DNS request, which usually also resolves the IP of the local gateway. Note: If no IP is provided, the function attempts to obtain the local IP address.
Example 1:Determins the hostname by a DNS query #
PS C:\> Get-Hostname (Get-GatewayIp)
# Output fritz.box
In this example, the IP address of the local gateway is determined, and then the hostname is obtained through a local DNS query.
Specifies the IP address for which to retrieve the host name. If not specified, the local IP address is used.
Type: String Parameter Sets: (All) Aliases: Required: False Position: 0 Default value: None Accept pipeline input: False Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.