-
Notifications
You must be signed in to change notification settings - Fork 1
Test‑IPv4Address
Tests if a string is a valid IPv4 address.
Test-IPv4Address [-IPAddress] <String> [<CommonParameters>]
Validates that the input string represents a valid IPv4 address by checking both format and value ranges (0-255 for each octet). This command also validates that octets do not have leading zeros (except for '0' itself) which is important for proper IPv4 address validation. Returns true if the input is a valid IPv4 address, false otherwise.
Test-IPv4Address -IPAddress '192.168.1.1'
This example tests a standard IPv4 address and returns True.
'192.168.1.1', '10.0.0.1' | Test-IPv4Address
This example demonstrates pipeline input with multiple IP addresses.
Test-IPv4Address -IPAddress '999.999.999.999'
This example tests an invalid IPv4 address with octets exceeding 255 and returns False.
Test-IPv4Address -IPAddress '192.168.01.1'
This example tests an IPv4 address with leading zeros in an octet and returns False.
Specifies the string to test as an IPv4 address. The string should be in the format of four decimal numbers separated by periods.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
This command performs strict validation including checking for leading zeros which are not allowed in standard IPv4 address notation.
- Assert-GitLocalChange
- Assert-GitRemote
- Assert-IPv4Address
- Clear-AnsiSequence
- ConvertTo-AnsiSequence
- ConvertTo-AnsiString
- ConvertTo-DifferenceString
- ConvertTo-RelativePath
- Disable-CursorShortcutCode
- Get-ClassAst
- Get-ClassResourceAst
- Get-GitBranchCommit
- Get-GitLocalBranchName
- Get-GitRemote
- Get-GitRemoteBranch
- Get-GitTag
- Get-LinkLayerAddress
- Get-ModuleByVersion
- Get-ModuleFileSha
- Get-ModuleVersion
- Get-NumericalSequence
- Get-PSReadLineHistory
- Get-TextOffset
- Install-ModulePatch
- Invoke-Git
- Invoke-PesterJob
- New-GitTag
- New-SamplerGitHubReleaseTag
- Out-Difference
- Pop-VMLatestSnapshot
- Push-GitTag
- Receive-GitBranch
- Remove-GitTag
- Remove-History
- Remove-PSHistory
- Remove-PSReadLineHistory
- Rename-GitLocalBranch
- Rename-GitRemote
- Request-GitTag
- Resolve-DnsName
- Resume-GitRebase
- Send-WakeOnLan
- Split-StringAtIndex
- Start-GitRebase
- Stop-GitRebase
- Switch-GitLocalBranch
- Test-FileHash
- Test-GitLocalChanges
- Test-GitRemote
- Test-GitRemoteBranch
- Test-IPv4Address
- Update-GitLocalBranch
- Update-RemoteTrackingBranch