Public/Get-specFirstThreeIPOctets.ps1
function Get-specFirstThreeIPOctets { [CmdletBinding()] param ( [Parameter()] [string]$IPAddress ) process { try { # Split the IP address into octets $octets = $IPAddress -split '\.' # Return the first three octets return ($octets[0..2] -join '.') } catch { Write-Error "Failed to process the IP address: $_" } } } |