Libraries/Lib.Windows.Winnt.WindowsPE.WinPE11/Lib.Windows.Winnt.WindowsPE.WinPE11.psm1
|
<#
.SYNOPSIS Get the release ID of an OS .DESCRIPTION The release ID of an OS is often a number identifying OS in time. It can return 1607 or 1809 on windows 10 or 16.04 or 18.10 on ubuntu. .EXAMPLE Get-OSReleaseId -Online .NOTES General notes #> function Get-OSReleaseId { [CmdletBinding()][OutputType([String])]Param ( [switch]$Online, [string]$Root ) Begin { Write-PwShFwOSEnterFunction } Process { return Lib.Windows\Get-OSDisplayVersion @PSBoundParameters } End { Write-PwShFwOSLeaveFunction } } function Get-OSProductname { [CmdletBinding()][OutputType([String])]Param ( [switch]$Online, [string]$Root ) Begin { Write-PwShFwOSEnterFunction } Process { if ($Online) { $RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" } else { $RegPath = Mount-OfflineWindowsRegistry -Path "$Root\Windows" -Hive SOFTWARE $RegPath = $RegPath + "\Microsoft\Windows NT\CurrentVersion" } if ($PSVersionTable.PSVersion.Major -lt 5) { $productName = (Get-ItemProperty $RegPath 'ProductName' -ErrorAction:SilentlyContinue).ProductName } else { $productName = Get-ItemPropertyValue $RegPath -Name ProductName } return ($productName -replace '(Windows.*?)\b10\b', '${1}11') } End { Write-PwShFwOSLeaveFunction } } |