New ‘Get-SBIPInfo’ function added to SBTools module retrieves computer IPv4 and IPv6 information


SBTools module can be downloaded from the Microsoft Script Center Repository.

To install it, extract the .rar file, and run install-SBTools.ps1 in the folder where you extracted the .rar file.

The Get-SBIPInfo function will retrieve computer IP information for one or more computers.

Sample output:

get-sbipinfo1

NAME
Get-SBIPInfo

SYNOPSIS
Function to get computer IP information.

SYNTAX
Get-SBIPInfo [[-ComputerName] <String[]>] [-WhatIf] [-Confirm] [<CommonParameters>]

DESCRIPTION
Function to get computer IP information.
Function returns an object that has the following properties:
ComputerName, AdapterDescription, IPAddress, IPVersion, SubnetMask, CIDR, MAC, DefaultGateway, DNSServer

PARAMETERS
-ComputerName <String[]>
Name(s) of the computer(s) to be used to get their IP information.

Required? false
Position? 1
Default value $env:COMPUTERNAME
Accept pipeline input? true (ByValue, ByPropertyName)
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 (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS
System.String[]

OUTPUTS
System.Object

NOTES
Function by Sam Boutros
V 1.0
08/12/2014

————————– EXAMPLE 1 ————————–

C:\PS>Get-SBIPInfo

This example retuns the current computer IP information

————————– EXAMPLE 2 ————————–

C:\PS>Get-SBIPInfo xhost11 | Out-GridView

This example displays IP information of computer xHost11

————————– EXAMPLE 3 ————————–

C:\PS>Get-Content .\computers.txt | Get-SBIPInfo

This example returns IP information of every computer listed in the computers.txt file

————————– EXAMPLE 4 ————————–

C:\PS>Get-SBIPInfo | Where-Object { $_.IPversion -eq 4 } | Select-Object { $_.IPAddress }

This example lists the IPv4 address(es) of the local computer

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s