description | ms.date | ms.topic | title |
---|---|---|---|
JSON schema reference for the '_exist' canonical DSC Resource property. |
02/28/2025 |
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/v3.0.0/resource/properties/exist.json
Type: boolean
DefaultValue: true
The _exist
canonical 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. Resources that define
this property indicate to DSC that they adhere to the contract for the canonical property.
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/v3.0/resource/properties/exist.json"
}