Posted On July 18, 2019

PowerShell: Use Regex to Select IPv4 Patterns

kimconnect 0 comments
blog.KimConnect.com >> Codes >> PowerShell: Use Regex to Select IPv4 Patterns
# This example shows how to obtain ip address of the $env:logonserver
$logonServerIP=nltest /DSGETDC:
$regexIP = [regex] "\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"
$regexIP.Matches($logonServerIP).Value

Leave a Reply

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

Related Post

Transfer Domain Controller Roles (Legacy Commands)

# Simple commands: netdom query fsmo ntdsutil roles connections connect to server SRVI-DC01 q transfer…

Resolving CRM Error Upon Login

Symptom: Error Message when trying to login to CRM [caption id="attachment_7481" align="alignnone" width="237"] INVALID ACTION[/caption]…

PowerShell: Obtaining SQL Database Default Paths

# This function returns an array of 3 string values reflecting default Data, Log, and…