-
Notifications
You must be signed in to change notification settings - Fork 13
/
Get-IpAddress.psm1
47 lines (33 loc) · 1.05 KB
/
Get-IpAddress.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<#
.SYNOPSIS
Get-IpAddress is a cmdlet created to get the basic IPv4 information.DESCRIPTION
This cmdlet returns the IPv4 address being used by a device.DESCRIPTION
.DESCRIPTION
Get-IpAddress returns the IPv4 addresses of a device for easy reading.DESCRIPTION
.NOTES
Author: Robert H. Osborne
Alias: tobor
Contact: [email protected]
.LINK
https://osbornepro.com
https://writeups.osbornepro.com
https://btpssecpack.osbornepro.com
https://github.com/tobor88
https://gitlab.com/tobor88
https://www.powershellgallery.com/profiles/tobor
https://www.linkedin.com/in/roberthosborne/
https://www.credly.com/users/roberthosborne/badges
https://www.hackthebox.eu/profile/52286
.EXAMPLE
Get-IpAddress
#>
Function Get-IpAddress {
[CmdletBinding()]
param()
Try {
Get-NetIpAddress -AddressFamily "IPv4" | Where-Object -Property "PrefixOrigin" -notlike "WellKnown" | Select-Object -ExpandProperty "IpAddress"
} # End Try
Catch {
Write-Warning "No network IPv4 Addresses are configured"
} # End Catch
} # End Function Get-IpAddress