Indented.NetworkTools is a collection of CmdLets dealing with IP maths; a MAC address manufacturer lookup function; and a number of other very small functions for SMTP and WhoIs.

Indented.NetworkTools replaces NetShell. Several CmdLets have been moved to other (specialist) modules and the content of this one improved.

Indented.NetworkTools features significant improvements in input handling over NetShell. Abbreviated CIDR syntax is now fully supported. For example:

Requirements

  • Your execution policy must be set to a minimum of AllSigned, Indented.NetworkTools is signed.
  • Indented.Common
  • A minimum of PowerShell 3.0; The module has also been tested under PowerShell 4.0.

Installation

Automatic installation

The following command from Indented.Common may be used to download and install or update Indented.NetworkTools.

Manual installation

  1. Follow the steps to install Indented.Common.
  2. Download Indented.NetworkTools.
  3. Extract the folder in the zip file to LibrariesDocumentsWindowsPowerShellModules.
  4. Execute the command below to verify the module is now installed.

Updates

  • 2.14 – ConvertTo-Subnet: Added to module.
  • 2.13 – Added ISC licence statement to manifest.
  • 2.10 to 2.12 – Trivial format bug fixes (non-functional change).
  • 2.9 – ConvertToNetworkObject: Fixed regex bug used to validate CIDR notation.
  • 2.8 – Signed module files.
  • 2.7 – Test-Smtp: Added <> to addresses.

Module commands

Exported commands

CmdLet Category Description
ConvertTo-BinaryIP IP maths Converts a Decimal IP address into a binary format.
ConvertTo-DecimalIP IP maths Converts a Decimal IP address into a 32-bit unsigned integer.
ConvertTo-DottedDecimalIP IP maths Converts either an unsigned 32-bit integer or a dotted binary string to an IP Address.
ConvertTo-HexIP IP maths Convert a dotted decimal IP address into a hexadecimal string.
ConvertFrom-HexIP IP maths Converts a hexadecimal IP address into a dotted decimal string.
ConvertTo-MaskLength IP maths Convert a dotted-decimal subnet mask to a mask length.
ConvertTo-Mask IP maths Convert a mask length to a dotted-decimal subnet mask.
ConvertTo-Subnet IP maths Convert a start and end IP address to the closest matching subnet.
Get-BroadcastAddress IP maths Get the broadcast address for a network range.
Get-NetworkAddress IP maths Get the network address for a network range.
Get-NetworkRange IP maths Get a list of IP addresses within the specified network.
Get-NetworkSummary IP maths Generates a summary describing several properties of a network range
Get-Subnets IP maths Get a list of subnets of a given size within a defined supernet.
Test-SubnetMember IP maths Tests an IP address to determine if it falls within IP address range.
Get-Manufacturer MAC address tools Get the manufacturer associated with a MAC address.
Update-ManufacturerList MAC address tools Updates the cached manufacturer list maintained by the IEEE.
Test-TcpPort General testing Test a TCP Port using System.Net.Sockets.TcpClient.
Get-PublicIP General testing Get information the current public IP address used by the client.
Test-Smtp SMTP Executes a simple SMTP conversation to test an SMTP service.
Get-WhoIs WhoIs Get a WhoIs record using servers published via whois-servers.net.

Internal commands

CmdLet Category Description
ConvertToNetworkObject IP maths Converts IP address formats to a set a known styles.

5 Comments

  1. I am getting an error in test-smtp. You have an update for the module?

    ConvertTo-String : The input object cannot be bound to any parameters for the command
    either because the command does not take pipeline input or the input and its
    properties do not match any of the parameters that take pipeline input.
    At C:UsersServerAdminDesktoptest.ps1:1228 char:32
    + Receive-Bytes $Socket | ConvertTo-String
    + ~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (@{BytesReceived…emoteEndPoint=}:PSOb
    ject) [ConvertTo-String], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,ConvertTo-String

    Reply

  2. This is a very useful tool. Thank you. I had to update the regular expression in Indented.NetworkTools.psm1 on line 88 because it did not account for IP addresses with octets that match 2[0-4][6-9] as shown by the error below:

    get-networksummary “192.168.229.0/24”
    get-networksummary : Invalid CIDR notation format.
    At line:1 char:1
    + get-networksummary “192.168.229.0/24”
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Get-NetworkSummary

    The new regex I used is:
    ^(?(?:[0-9]{1,2}|[0-1][0-9]{2}|2[0-4][0-9]|25[0-5])(?:.(?:[0-9]{1,2}|[0-1][0-9]{2}|2[0-4][0-9]|25[0-5])){0,3})[\/](?d+)$

    Reply

    • That was a bit of a silly error on my part, thank you very much. I’ve fixed it and republished the module (version 2.9).

      Cheers!

      Chris

      Reply

  3. Hello,

    I like the utilities very much and created corresponding workflows in BMC Atrium Orchestrator. The subnet calculations helped with a recent project. These workflows can be called via WebServices or RESTful API, and return the result in JSON format.

    Regards, Orchestrator

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *