From 424331c5e154b7152d7dc6aad31c1153e7702cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Mach?= Date: Mon, 27 May 2024 15:32:07 +0200 Subject: [PATCH 1/2] fix PSAnalyzer remediations --- Scripts/2_CreateParentDisks.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Scripts/2_CreateParentDisks.ps1 b/Scripts/2_CreateParentDisks.ps1 index 40e3adde..cbe931ca 100644 --- a/Scripts/2_CreateParentDisks.ps1 +++ b/Scripts/2_CreateParentDisks.ps1 @@ -1223,11 +1223,11 @@ If (-not $isAdmin) { $vhdProperties['vhd.os.language'] = $OSLanguage } } - $events += New-TelemetryEvent -Event "CreateParentDisks.Vhd" -Metrics $vhdMetrics -Properties $vhdProperties -NickName $LabConfig.TelemetryNickName + $events += Initialize-TelemetryEvent -Event "CreateParentDisks.Vhd" -Metrics $vhdMetrics -Properties $vhdProperties -NickName $LabConfig.TelemetryNickName } # and one overall - $events += New-TelemetryEvent -Event "CreateParentDisks.End" -Metrics $metrics -Properties $properties -NickName $LabConfig.TelemetryNickName + $events += Initialize-TelemetryEvent -Event "CreateParentDisks.End" -Metrics $metrics -Properties $properties -NickName $LabConfig.TelemetryNickName Send-TelemetryEvents -Events $events | Out-Null } From 6f5e4b6c72979581cd8721b05a1fe06bb00b7521 Mon Sep 17 00:00:00 2001 From: "Michael Bernstein (DPLAT)" Date: Fri, 4 Oct 2024 16:16:36 -0700 Subject: [PATCH 2/2] Install PSDesiredStateConfiguration module if it is not installed 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 --- Scripts/1_Prereq.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Scripts/1_Prereq.ps1 b/Scripts/1_Prereq.ps1 index 87823565..d9e2f442 100644 --- a/Scripts/1_Prereq.ps1 +++ b/Scripts/1_Prereq.ps1 @@ -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.