From 142138246f8db11b968b3f46f10dbc3aff168465 Mon Sep 17 00:00:00 2001 From: Jack-Ed <144899849+Jack-Ed@users.noreply.github.com> Date: Mon, 19 Aug 2024 12:58:02 +0100 Subject: [PATCH] Update Validate-NDESConfiguration.ps1 Get-WmiObject is depracated (https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-wmiobject?view=powershell-5.1) This caused an issue when running with PowerShell 7 as a I received: The term 'Get-WmiObject' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Replaced: (Get-WmiObject Win32_ComputerSystem).domain With: (Get-ADDomain).DNSRoot --- CertificationAuthority/Validate-NDESConfiguration.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CertificationAuthority/Validate-NDESConfiguration.ps1 b/CertificationAuthority/Validate-NDESConfiguration.ps1 index 73ac914..9be0f9c 100644 --- a/CertificationAuthority/Validate-NDESConfiguration.ps1 +++ b/CertificationAuthority/Validate-NDESConfiguration.ps1 @@ -63,7 +63,7 @@ Param( [parameter(Mandatory=$true,ParameterSetName="NormalRun")] [alias("ca")] [ValidateScript({ - $Domain = (Get-WmiObject Win32_ComputerSystem).domain + $Domain = (Get-ADDomain).DNSRoot if ($_ -match $Domain) { $True