-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy path25_5.ps1
More file actions
23 lines (23 loc) · 704 Bytes
/
25_5.ps1
File metadata and controls
23 lines (23 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function Get-DnsHostByAddress {
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true,
ValueFromPipeline=$true)]
[string[]]$Address
)
BEGIN {}
PROCESS {
ForEach ($Addr in $Address) {
$props = @{'Address'=$addr}
Try {
$result = [System.Net.Dns]::GetHostByAddress($addr)
$props.Add('HostName',$result.HostName)
} Catch {
$props.Add('HostName',$null)
}
New-Object -TypeName PSObject -Property $props
} #foreach
} #PROCESS
END {}
} #function
Get-DnsHostByAddress -Address '204.79.197.200','192.168.254.254', '35.166.24.88'