-
Notifications
You must be signed in to change notification settings - Fork 9
Test DscProperty
Tests whether the class-based resource has the specified property.
Test-DscProperty [-InputObject] <PSObject> [-Name] <String> [-HasValue] [[-Attribute] <String[]>]
[<CommonParameters>]
Tests whether the class-based resource has the specified property, and can optionally tests if the property has a certain attribute or whether it is assigned a non-null value.
Test-DscProperty -InputObject $this -Name 'MyDscProperty'
Returns $true
or $false
whether the property exist or not.
$this | Test-DscProperty -Name 'MyDscProperty'
Returns $true
or $false
whether the property exist or not.
Test-DscProperty -InputObject $this -Name 'MyDscProperty' -HasValue
Returns $true
if the property exist and is assigned a non-null value,
if not $false
is returned.
Test-DscProperty -InputObject $this -Name 'MyDscProperty' -Attribute 'Optional'
Returns $true
if the property exist and is an optional property.
Test-DscProperty -InputObject $this -Name 'MyDscProperty' -Attribute 'Optional' -HasValue
Returns $true
if the property exist, is an optional property, and is
assigned a non-null value.
Specifies if the property should be evaluated to have a specific attribute.
If the property exist but is not the specific attribute the command returns
$false
.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Specifies if the property should be evaluated to have a non-value.
If
the property exist but is assigned $null
the command returns $false
.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Specifies the object that should be tested for existens of the specified property.
Type: PSObject
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Specifies the name of the property.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
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]].
- Assert-BoundParameter
- Assert-ElevatedUser
- Assert-IPAddress
- Assert-Module
- Compare-DscParameterState
- Compare-ResourcePropertyState
- ConvertFrom-DscResourceInstance
- ConvertTo-CimInstance
- ConvertTo-HashTable
- Find-Certificate
- Get-ComputerName
- Get-DscProperty
- Get-EnvironmentVariable
- Get-LocalizedData
- Get-LocalizedDataForInvariantCulture
- Get-PSModulePath
- Get-TemporaryFolder
- Get-UserName
- New-ArgumentException
- New-ErrorRecord
- New-Exception
- New-InvalidDataException
- New-InvalidOperationException
- New-InvalidResultException
- New-NotImplementedException
- New-ObjectNotFoundException
- Remove-CommonParameter
- Set-DscMachineRebootRequired
- Set-PSModulePath
- Test-AccountRequirePassword
- Test-DscParameterState
- Test-DscProperty
- Test-IsNanoServer
- Test-IsNumericType
- Test-ModuleExist