From f2b9f7d5abc5591c9e797645fb9379e5a8d608bd Mon Sep 17 00:00:00 2001 From: Mike Richmond Date: Mon, 23 Jan 2017 13:07:38 -0800 Subject: [PATCH] Add WindowsUBR to Get-ComputerInfo (#2995) --- .../commands/management/GetComputerInfoCommand.cs | 10 +++++++++- .../Get-ComputerInfo.Tests.ps1 | 4 +++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs index 9212ff14ee..be64ab7f26 100644 --- a/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs +++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/GetComputerInfoCommand.cs @@ -639,6 +639,7 @@ namespace Microsoft.PowerShell.Commands output.WindowsRegisteredOwner = regCurVer.RegisteredOwner; output.WindowsSystemRoot = regCurVer.SystemRoot; output.WindowsVersion = regCurVer.ReleaseId; + output.WindowsUBR = regCurVer.UBR; } var os = osInfo.os; @@ -1261,7 +1262,8 @@ namespace Microsoft.PowerShell.Commands RegisteredOrganization = (string)key.GetValue("RegisteredOrganization"), RegisteredOwner = (string)key.GetValue("RegisteredOwner"), SystemRoot = (string)key.GetValue("SystemRoot"), - ReleaseId = (string)key.GetValue("ReleaseId") + ReleaseId = (string)key.GetValue("ReleaseId"), + UBR = (int?)key.GetValue("UBR") }; } } @@ -1955,6 +1957,7 @@ namespace Microsoft.PowerShell.Commands public string RegisteredOwner; public string SystemRoot; public string ReleaseId; + public int? UBR; } #endregion Other Intermediate classes @@ -2230,6 +2233,11 @@ namespace Microsoft.PowerShell.Commands /// The Windows ReleaseId, from the Windows Registry. /// public string WindowsVersion { get; internal set; } + + /// + /// The Windows Update Build Revision (UBR), from the Windows Registry. + /// + public int? WindowsUBR { get; internal set; } #endregion Registry #region BIOS diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ComputerInfo.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ComputerInfo.Tests.ps1 index 2c2c3e0f9b..0830cc61fd 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ComputerInfo.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-ComputerInfo.Tests.ps1 @@ -203,7 +203,8 @@ function Get-PropertyNamesForComputerInfoTest "WindowsRegisteredOrganization", "WindowsRegisteredOwner", "WindowsSystemRoot", - "WindowsVersion") + "WindowsVersion", + "WindowsUBR") if ([System.Management.Automation.Platform]::IsIoT) { @@ -975,6 +976,7 @@ public static extern int LCIDToLocaleName(uint localeID, System.Text.StringBuild "WindowsRegisteredOrganization" {return Get-WinNtCurrentVersion RegisteredOrganization} "WindowsRegisteredOwner" {return Get-WinNtCurrentVersion RegisteredOwner} "WindowsVersion" {return Get-WinNtCurrentVersion ReleaseId} + "WindowsUBR" {return Get-WinNtCurrentVersion UBR} "WindowsSystemRoot" {return [System.Environment]::GetEnvironmentVariable("SystemRoot")}