Skip to content

Commit

Permalink
Install PSDesiredStateConfiguration module if it is not installed
Browse files Browse the repository at this point in the history
As of PowerShell 7.2, this module is now shipped separately
and must be installed explicitly.

For more details, see:
https://learn.microsoft.com/en-us/powershell/dsc/overview?view=dsc-2.0
  • Loading branch information
Michael Bernstein (DPLAT) authored and Michael Bernstein (DPLAT) committed Oct 4, 2024
1 parent 9ffe266 commit 6f5e4b6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Scripts/1_Prereq.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ function Get-WindowsBuildNumber {

#endregion

#region Installing PSDesiredStateConfiguration from the PowerShell gallery

# See https://learn.microsoft.com/en-us/powershell/dsc/overview?view=dsc-2.0 for details
# on the breaking change that requires this module to be installed.
WriteInfoHighlighted "Testing if PSDesiredStateConfiguration is present"
if (!(Get-Module -ListAvailable -Name PSDesiredStateConfiguration)) {
WriteInfo "`t Module PSDesiredStateConfiguration not found... Downloading"
Install-Module -Name PSDesiredStateConfiguration -Repository PSGallery -MaximumVersion 2.99
}

#endregion

#region Downloading required Posh Modules
# Downloading modules into Temp folder if needed.

Expand Down

0 comments on commit 6f5e4b6

Please sign in to comment.