| description | Invalid unquoted multi-dot value construction |
|---|---|
| ms.date | 07/24/2026 |
| ms.topic | reference |
| title | InvalidMultiDotValue |
Severity Level: Warning
Default state: Disabled
PowerShell doesn't support unquoted literal values with multiple dots (.). Any value with two or
more dots results in $null, which can lead to unexpected behavior or errors in the code. This rule
identifies instances where such values are used.
To create values with multiple dots you must enclose the value in quotes and use type-casting or use type constructor methods to create the appropriate object.
$version = 1.2.3or even:
$IP = [System.Net.IPAddress]127.0.0.1Where both examples result in $null instead of the expected value.
# Use type-casting with quoted value
$IP = [System.Net.IPAddress]'127.0.0.1'
$version = [Version]'1.2.3'
# Use type constructor method
$version = [Version]::new(1, 2, 3)Rules = @{
PSInvalidMultiDotValue = @{
Enable = $true
}
}-
Enable: bool (Default value is$false)Enable or disable the rule during ScriptAnalyzer invocation.