Skip to content

New-PropertyValue

SYNOPSIS

Creates 1 string from 1 or more values.

SYNTAX

1
2
New-PropertyValue [[-Object] <PSObject>] [[-Attributes] <Array>] [[-CombineCharacter] <Array>]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

The New-PropertyValue function combines 1 or more values into 1 string, with or without a "combine character".

EXAMPLES

EXAMPLE 1

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$InputObject = [PSCustomObject]@{
>>    property1 = "value1"
>>    property2 = "value2"
>> }
PS C:\> $Combine = [PSCustomObject]@{
>>    attributes = @("property1","property2")
>>    character = '-'
>> }
PS C:\> New-PropertyValue -Object $InputObject -Attributes $Combine.attributes -CombineCharacter $Combine.character
value1-value2

EXAMPLE 2

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
$InputObject = [PSCustomObject]@{
>>    property1 = "value1"
>>    property2 = "value2"
>> }
PS C:\> $Combine = [PSCustomObject]@{
>>    attributes = @("property1","property2")
>>    character = ''
>> }
PS C:\> New-PropertyValue -Object $InputObject -Attributes $Combine.attributes -CombineCharacter $Combine.character
value1value2

PARAMETERS

-Attributes

Array of attributes / properties on the object supplies to the Object parameter.

1
2
3
4
5
6
7
8
9
Type: Array
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-CombineCharacter

Specifies what character, if any, to put between each value.

1
2
3
4
5
6
7
8
9
Type: Array
Parameter Sets: (All)
Aliases:

Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Object

Object to get values from.

1
2
3
4
5
6
7
8
9
Type: PSObject
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

Determines how PowerShell responds to progress updates generated by a script, cmdlet, or provider, such as the progress bars generated by the Write-Progress cmdlet. The Write-Progress cmdlet creates progress bars that show a command's status.

The ProgressAction parameter takes one of the ActionPreference enumeration values: SilentlyContinue, Stop, Continue, Inquire, Ignore, Suspend, or Break.

1
2
3
4
5
6
7
8
9
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
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

PSCustomObject

System.Array

OUTPUTS

System.String

NOTES