Installing Microsoft Desired State Configuration (DSC)
Before you get started, you need the actual CLI to work with. For that, you need to install DSC on your machine. In the following sections, you can find instructions on how to install it on Windows, Linux, or macOS.
Installing DSC for Windows manually from GitHub
To install DSC for Windows from GitHub, follow these steps:
Step 1 - Determine your OS architecture
There are multiple methods for determining the operating system (OS) architecture. The following three examples demonstrate the use of the command prompt, PowerShell, or msinfo.
- Open a command prompt and type:
echo %PROCESSOR_ARCHITECTURE%
. - Open a PowerShell terminal session and type:
[System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture
. - In your Quick Start menu, type in
msinfo32.exe
and locate theSystem Type
property in the System Summary.
Step 2 - Download the asset
After determining your OS architecture, proceed to download the release asset from GitHub.
- Open the following link in your favorite browser.
- Select the version you want to download and scroll down.
- Expand the Assets and press the asset relevant to your OS architecture.

- Save the file to your Downloads folder.
Step 3 - Expand the archive and add to PATH
When the download is finished, you can expand the files to extract them to your application data folder.
- Right-click the file and select Extract All…
- Extract the files to
C:\Users\<userProfile>\AppData\Local\dsc
by replacing the<userProfile>
with your profile name. - Open a command prompt and type:
rundll32.exe sysdm.cpl,EditEnvironmentVariables
to open the environment variables. - In your user variables, edit your
PATH
environment variable and include the pathC:\Users\<userProfile>\AppData\Local\dsc
.
Step 4 - Verify the installation
- Open a command prompt or PowerShell terminal session.
- Type
dsc --version
:
dsc --version
This should return the DSC version installed.
Installing DSC for Windows using PowerShell
To install DSC for Windows using PowerShell, you can run the following commands in a PowerShell terminal session.
Option 1 - Using PSDSC module
To install DSC using the PSDSC module, follow the steps below:
- Open a PowerShell terminal session.
- Install the
PSDSC
module by typing:Install-PSResource -Name PSDSC
- Execute
Install-DscExe
in the same terminal session
PSDSC
module for the PSDesiredStateConfiguration
.Option 2 - Use PowerShell script
To install DSC using a PowerShell script, open a PowerShell terminal session and copy and paste the following:
# Define the GitHub repository and the asset pattern to download
$repo = "PowerShell/DSC"
$assetPattern = "dsc-win-.*.zip"
# Get the latest release information from GitHub API
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/$repo/releases/latest"
$assetPattern = if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64')
{
'DSC-*-aarch64-pc-windows-msvc.zip'
}
else
{
'DSC-*-x86_64-pc-windows-msvc.zip'
}
# Find the asset that matches the pattern
$asset = $release.assets | Where-Object { $_.name -like $assetPattern }
if ($asset)
{
# Download the asset
$assetUrl = $asset.browser_download_url
$downloadPath = Join-Path -Path $env:TEMP -ChildPath $asset.name
Invoke-RestMethod -Uri $assetUrl -OutFile $downloadPath
# Define the extraction path
$extractPath = Join-Path -Path $env:LOCALAPPDATA -ChildPath 'dsc'
# Create the extraction directory if it doesn't exist
if (-not (Test-Path -Path $extractPath)) {
New-Item -ItemType Directory -Path $extractPath
}
# Extract the downloaded zip file
if (Get-Command -Name 'Expand-Archive')
{
Expand-Archive -Path $downloadPath -DestinationPath $extractPath -Force
}
else
{
Add-Type -AssemblyName System.IO.Compression.FileSystem
[System.IO.Compression.ZipFile]::ExtractToDirectory($downloadPath, $extractPath)
}
# Clean up the downloaded zip file
Remove-Item -Path $downloadPath -ErrorAction SilentlyContinue
# Unblock all files
Get-ChildItem -Path $extractPath -Recurse | Unblock-File
# Add to PATH
$env:PATH += ";$extractPath"
# Verify the installation
dsc --version
}
Installing DSC on Linux
To install DSC on Linux, follow these steps:
Step 1 - Download the asset
- Open a terminal session.
- Determine your OS architecture by typing:
uname -m
- Download the DSC release asset using
wget
. Replace<version>
with the desired version number and<architecture>
with your OS architecture (e.g.,x86_64
):
wget https://github.com/PowerShell/DSC/releases/download/v<version>/DSC-<version>-<architecture>-linux.tar.gz
Step 2 - Extract the archive
- Create a directory to extract the files:
mkdir dsc
- Extract the downloaded tar.gz file to the created directory:
tar -xvzf DSC-<version>-<architecture>-linux.tar.gz -C dsc
Step 3 - Move files to the appropriate location
- Move the extracted files to
/usr/local/bin/
:
sudo mv dsc/* /usr/local/bin/
Step 4 - Update PATH environment variable in .bashrc
- Add the DSC path to your
~/.bashrc
file:
echo 'export PATH=$PATH:/usr/local/bin/dsc' >> ~/.bashrc
- Optionally, reload the
~/.bashrc
file to apply the changes:
source ~/.bashrc
Step 5 - Verify the installation
- Open a terminal session.
- Type
dsc --version
to verify the installation:
dsc --version
This should return the DSC version installed.
Installing DSC on MacOS
To install DSC on MacOS, follow these steps:
Step 1 - Download the asset
- Open a terminal session.
- Download the DSC release asset using
curl
. Replace<version>
with the desired version number and<architecture>
with your OS architecture (e.g.,x86_64
):
curl -L https://github.com/PowerShell/DSC/releases/download/v<version>/DSC-<version>-<architecture>-apple-darwin.tar.gz -o DSC-<version>-<architecture>-apple-darwin.tar.gz
Step 2 - Extract the archive
- Create a directory to extract the files:
mkdir dsc
- Extract the downloaded tar.gz file to the created directory:
tar -xvzf DSC-<version>-<architecture>-apple-darwin.tar.gz -C dsc
Step 3 - Move files to the appropriate location
- Move the extracted files to
/usr/local/bin/
:
sudo mv dsc/* /usr/local/bin/
Step 4 - Update PATH environment variable in .zshrc
- Add the DSC path to your
~/.zshrc
file:
echo 'export PATH=$PATH:/usr/local/bin' >> ~/.zshrc
- Optionally, reload the
~/.zshrc
file to apply the changes:
source ~/.zshrc
Step 5 - Verify the installation
- Open a terminal session.
- Type
dsc --version
to verify the installation:
dsc --version
This should return the DSC version installed.
Next up
You have now successfully installed DSC on your machine. Explore the following lesson in the navigation section.