Get‑DscProperty - dsccommunity/DscResource.Common GitHub Wiki

SYNOPSIS

Returns DSC resource properties that is part of a class-based DSC resource.

SYNTAX

Default (Default)

Get-DscProperty -InputObject <PSObject> [-Name <String[]>] [-ExcludeName <String[]>] [-Attribute <String[]>]
 [<CommonParameters>]

HasValue

Get-DscProperty -InputObject <PSObject> [-Name <String[]>] [-ExcludeName <String[]>] [-Attribute <String[]>]
 [-HasValue] [-IgnoreZeroEnumValue] [<CommonParameters>]

DESCRIPTION

Returns DSC resource properties that is part of a class-based DSC resource. The properties can be filtered using name, attribute, or if it has been assigned a non-null value.

EXAMPLES

EXAMPLE 1

Get-DscProperty -InputObject $this

Returns all DSC resource properties of the DSC resource.

EXAMPLE 2

$this | Get-DscProperty

Returns all DSC resource properties of the DSC resource.

EXAMPLE 3

Get-DscProperty -InputObject $this -Name @('MyProperty1', 'MyProperty2')

Returns the DSC resource properties with the specified names.

EXAMPLE 4

Get-DscProperty -InputObject $this -Attribute @('Mandatory', 'Optional')

Returns the DSC resource properties that has the specified attributes.

EXAMPLE 5

Get-DscProperty -InputObject $this -Attribute @('Optional') -HasValue

Returns the DSC resource properties that has the specified attributes and has a non-null value assigned.

EXAMPLE 6

Get-DscProperty -InputObject $this -Attribute @('Optional') -HasValue -IgnoreZeroEnumValue

Returns the DSC resource properties that has the specified attributes and has a non-null value assigned, and any Enum properties that has a non-zero value.

PARAMETERS

-Attribute

Specifies one or more property attributes to return. If left out all property types are returned.

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

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

-ExcludeName

Specifies one or more property names to exclude.

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

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

-HasValue

Specifies to return only properties that has been assigned a non-null value. If left out all properties are returned regardless if there is a value assigned or not.

Type: SwitchParameter
Parameter Sets: HasValue
Aliases:

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

-IgnoreZeroEnumValue

Specifies to return only Enum properties that has been assigned a non zero value.

Type: SwitchParameter
Parameter Sets: HasValue
Aliases:

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

-InputObject

The object that contain one or more key properties.

Type: PSObject
Parameter Sets: (All)
Aliases:

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

-Name

Specifies one or more property names to return. If left out all properties are returned.

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

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

OUTPUTS

System.Collections.Hashtable

[System.Collections.Hashtable]

NOTES

This command only works with nullable data types, if using a non-nullable type make sure to make it nullable, e.g. [Nullable[System.Int32]].

RELATED LINKS

⚠️ **GitHub.com Fallback** ⚠️