Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: >
Demonstrates how to manage packages with the DSC.PackageManagement/Apt resource
ms.date: 07/03/2025
ms.date: 06/30/2025
ms.topic: reference
title: Manage packages with APT
---
Expand All @@ -23,8 +23,8 @@ dsc resource test --resource DSC.PackageManagement/Apt --input '{"packageName":"
When the package is not installed, DSC returns the following result.

> [!NOTE]
> Note that the version and source values can differ depending on your system's package
> repositories and available package versions.
> Note that the version and source values can differ depending on your system's package repositories
> and available package versions.

```yaml
desiredState:
Expand All @@ -41,7 +41,8 @@ differingProperties:

## Ensure a package is installed

To ensure the system is in the desired state, use the [dsc resource set][01] command.
To ensure the system is in the desired state, use the [dsc resource set][01]
command.

```bash
dsc resource set --resource DSC.PackageManagement/Apt --input '{"packageName":"nginx"}'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: DSC.PackageManagement/Apt resource reference documentation
ms.date: 07/03/2025
ms.date: 06/30/2025
ms.topic: reference
title: DSC.PackageManagement/Apt
---
Expand Down Expand Up @@ -118,8 +118,8 @@ IsWriteOnly : false

</details>

Defines the name of the package to query or install. This property is required and serves as the
key for uniquely identifying the package.
Defines the name of the package to query or install. This property is required and serves as the key
for uniquely identifying the package.

### _exist

Expand All @@ -136,10 +136,10 @@ DefaultValue : true

</details>

The `_exist` canonical resource property determines whether a package should exist. When the value
for `_exist` is `true`, the resource installs the package if it doesn't exist. When the value for
`_exist` is `false`, the resource removes or uninstalls the package if it does exist. The default
value for this property when not specified for an instance is `true`.
The `_exist` canonical resource property determines whether a package should exist. When the
value for `_exist` is `true`, the resource installs the package if it doesn't exist. When
the value for `_exist` is `false`, the resource removes or uninstalls the package if it does exist.
The default value for this property when not specified for an instance is `true`.

### version

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
description: >
Demonstrates how to install a package with the DSC.PackageManagement/Brew resource
ms.date: 07/03/2025
ms.topic: reference
title: Install a package with Brew
---

# Install a package with Brew

This example demonstrates how to use the `DSC.PackageManagement/Brew` resource to install a package
on macOS systems using Brew.

## Test if package is installed

The following snippet shows how you can use the resource with the [dsc resource test][00] command
to check whether the `node` package exists.

```bash
dsc resource test --resource DSC.PackageManagement/Brew --input '{"packageName":"node"}'
```

When the package is not installed, DSC returns the following result.

```yaml
desiredState:
packageName: node
actualState:
_exist: false
packageName: node
version: ""
inDesiredState: false
differingProperties:
- _exist
```

## Ensure a package is installed

To ensure the system is in the desired state, use the [dsc resource set][01]
command.

```bash
dsc resource set --resource DSC.PackageManagement/Brew --input '{"packageName":"node"}'
```

When the resource installs the package, DSC returns the following result:

```yaml
beforeState:
packageName: "node"
version: ""
_exist: false
afterState:
_exist: true
packageName: node
version: "24.3.0"
changedProperties:
- _exist
- version
```

> [!NOTE]
> Note that the version can differ depending on your system's package repositories
> and available package versions.

You can test the instance again to confirm that the package exists:

```bash
dsc resource test --resource DSC.PackageManagement/Brew --input '{"packageName":"node"}'
```

```yaml
desiredState:
packageName: node
actualState:
_exist: true
packageName: node
version: "24.3.0"
inDesiredState: true
differingProperties: []
```

<!-- Link reference definitions -->
[00]: ../../../../../cli/resource/test.md
[01]: ../../../../../cli/resource/set.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
description: >
Demonstrates how to remove a package with the DSC.PackageManagement/Brew resource
ms.date: 07/03/2025
ms.topic: reference
title: Remove a package with Brew
---

# Remove a package with Brew

This example demonstrates how to use the `DSC.PackageManagement/Brew` resource to remove a package
on macOS systems using Brew.

## Test if package is installed

The following snippet shows how you can use the resource with the [dsc resource test][00] command
to check whether the `node` package doesn't exist.

```bash
dsc resource test --resource DSC.PackageManagement/Brew --input '{"packageName":"node","_exist":false}'
```

When the package is installed, DSC returns the following result.

```yaml
desiredState:
packageName: node
_exist: false
actualState:
_exist: true
packageName: node
version: "24.3.0"
inDesiredState: false
differingProperties:
- _exist
```

## Ensure a package is removed

To ensure the system is in the desired state, use the [dsc resource set][01]
command.

```bash
dsc resource set --resource DSC.PackageManagement/Brew --input '{"packageName":"node","_exist":false}'
```

When the resource removes the package, DSC returns the following result:

```yaml
beforeState:
packageName: "node"
version: "24.3.0"
_exist: true
afterState:
_exist: false
packageName: node
version: ""
changedProperties:
- _exist
- version
```

You can test the instance again to confirm that the package has been removed:

```bash
dsc resource test --resource DSC.PackageManagement/Brew --input '{"packageName":"node","_exist":false}'
```

```yaml
desiredState:
packageName: node
_exist: false
actualState:
_exist: false
packageName: node
version: ""
inDesiredState: true
differingProperties: []
```

<!-- Link reference definitions -->
[00]: ../../../../../cli/resource/test.md
[01]: ../../../../../cli/resource/set.md
Loading