description | ms.date | ms.topic | title |
---|---|---|---|
JSON schema reference for the '_exist' well-known DSC Resource property. |
10/05/2023 |
reference |
DSC Resource _exist property schema |
Indicates whether an instance should exist.
SchemaDialect: https://json-schema.org/draft/2020-12/schema
SchemaID: https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/resource/properties/exist.json
Type: boolean
DefaultValue: true
The _exist
property indicates that the resource can enforce whether instances exist, handling
whether an instance should be added, updated, or removed during a set operation. This property
provides shared semantics for DSC Resources and integrating tools, but doesn't enable any
additional built-in processing with DSC.
Resources should only define this property when their implementation adheres to the following behavior contract:
-
When the desired state for
_exist
istrue
, the resource expects the instance to exist. If it doesn't exist, the resource creates or adds the instance during the set operation. -
When the desired state for
_exist
isfalse
, the resource expects the instance to not exist. If it does exist, the resource deletes or removes the instance during the set operation. -
When the get operation queries for an instance that doesn't exist, the returned JSON always defines the
_exist
property asfalse
.The resource may omit the
_exist
property from the result JSON when the instance exists.
To add this property to a resource's instance schema, define the property with the following snippet:
"_exist": {
"$ref": "https://raw.githubusercontent.com/PowerShell/DSC/main/schemas/2024/04/resource/properties/exist.json"
}