From d9ce82a395eef154f9d238b8e25e9d839c7b55b3 Mon Sep 17 00:00:00 2001 From: Dinesh Reddy Gottam Date: Tue, 20 Apr 2021 12:20:40 -0700 Subject: [PATCH] Getting build number from CimInstance Using the right way to get OS build number which works after OS update as well. --- src/StackHCI/Az.StackHCI.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/StackHCI/Az.StackHCI.psm1 b/src/StackHCI/Az.StackHCI.psm1 index 15addc98f2ec..038be693287e 100644 --- a/src/StackHCI/Az.StackHCI.psm1 +++ b/src/StackHCI/Az.StackHCI.psm1 @@ -825,7 +825,7 @@ param( # Check if all nodes have required OS version $nodeUBR = Invoke-Command -Session $nodeSession -ScriptBlock { (Get-ItemProperty -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").UBR } - $nodeBuildNumber = Invoke-Command -Session $nodeSession -ScriptBlock { (Get-ItemProperty -path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion").CurrentBuildNumber } + $nodeBuildNumber = Invoke-Command -Session $nodeSession -ScriptBlock { (Get-CimInstance -ClassName CIM_OperatingSystem).BuildNumber } if(($nodeBuildNumber -lt $GAOSBuildNumber) -or (($nodeBuildNumber -eq $GAOSBuildNumber) -and ($nodeUBR -lt $GAOSUBR))) {