Skip to content

Get DscProperty

dscbot edited this page Feb 13, 2024 · 2 revisions

Get-DscProperty

SYNOPSIS

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

SYNTAX

Get-DscProperty [-InputObject] <PSObject> [[-Name] <String[]>] [[-ExcludeName] <String[]>]
 [[-Attribute] <String[]>] [-HasValue] [<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.

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: 4
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: 3
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: (All)
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: 1
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: 2
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

Clone this wiki locally