Skip to content

Get PropertyHashFromListOutput

dscbot edited this page Sep 20, 2026 · 1 revision

Get-PropertyHashFromListOutput

SYNOPSIS

Converts line-oriented native output into a property hashtable.

SYNTAX

AddExtraPropertiesUnderKey (Default)

Get-PropertyHashFromListOutput -Output <Object> [-Regex <Regex>] [-AllowedPropertyName <String[]>]
 [-AddExtraPropertiesAsKey <String>] [-ErrorHandling <ScriptBlock>] 
 [<CommonParameters>]

DiscardExtraProperties

Get-PropertyHashFromListOutput -Output <Object> [-Regex <Regex>] [-AllowedPropertyName <String[]>]
 [-DiscardExtraProperties] [-ErrorHandling <ScriptBlock>] 
 [<CommonParameters>]

DESCRIPTION

Parses lines containing named property and value groups, normalizes property names, appends continuation lines, and routes redirected standard-error records to a caller-provided handler.

EXAMPLES

EXAMPLE 1

'Name: PowerShell', 'Version: 7.6' |
    Get-PropertyHashFromListOutput

Returns a hashtable containing Name and Version.

PARAMETERS

-AddExtraPropertiesAsKey

Specifies the nested hashtable key used for properties that are not in AllowedPropertyName.

Type: String
Parameter Sets: AddExtraPropertiesUnderKey
Aliases:

Required: False
Position: Named
Default value: ExtraProperties
Accept pipeline input: False
Accept wildcard characters: False

-AllowedPropertyName

Specifies property names to retain at the top level. The default '*' accepts every parsed property.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: *
Accept pipeline input: False
Accept wildcard characters: False

-DiscardExtraProperties

Discards parsed properties that are not listed in AllowedPropertyName.

Type: SwitchParameter
Parameter Sets: DiscardExtraProperties
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: True (ByPropertyName)
Accept wildcard characters: False

-ErrorHandling

Specifies the script block that receives redirected standard-error records.

Type: ScriptBlock
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: { Write-Error $_ }
Accept pipeline input: False
Accept wildcard characters: False

-Output

Specifies one or more native-command output lines or error records.

Type: Object
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-Regex

Specifies the regular expression used to capture named property and val groups.

Type: Regex
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: ^\s*(?<property>[\w-\s]*):\s*(?<val>.*)
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.Collections.Hashtable

NOTES

RELATED LINKS