Code Monkey home page Code Monkey logo

ashleyhow / windowsosbuild Goto Github PK

View Code? Open in Web Editor NEW
44.0 44.0 14.0 2.36 MB

Windows patch release information (Version, Build, Availability date, Hotpatch, Preview, Out-of-band, Servicing option, KB article, KB URL and Catalog URL) for Windows client and server versions. Useful for scripting and automation purposes. Supports Windows 10 and Windows Server 2016 onwards. Supports Hotpatch on Windows Server 2022 Azure Edition.

License: MIT License

PowerShell 100.00%
patching powershell powershell-module

windowsosbuild's People

Contributors

ashleyhow avatar aumoulinon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

windowsosbuild's Issues

Whats the most simple way to detect if the Current OSBuild still gets security updates?

Hello

Thanks a lot for sharing your great work!

Customers pay billions to Microsoft and in 2023, it's a shame that they do not offer a REST Service that offers this information.

I probably have a question about the most common use case:

How can we tell until which date the current OS Build receives security updates?

In our days this information is very important and I suppose your WindowsOSBuild Module is a very good source of information for this question. But I don't know what information I have to interpret for this question to get a 100% sure answer.

Thanks a lot, kind regards,
Thomas

Querying for Windows Server 2022 throws a lot of errors + the result

PS U:\> Get-LatestOSBuild -OSVersion 21H2 -OSName Server2022 -ExcludePreview -ExcludeOutOfBand
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Get-Date : Cannot bind parameter 'Date' to the target. Exception setting "Date": "Cannot convert null to type "System.DateTime"."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:163 char:40
+                 $FormatDate =  Get-Date($ConvertToDate) -Format 'yyyy ...
+                                        ~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Get-Date], ParameterBindingException
    + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.GetDateCommand
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Get-Date : Cannot bind parameter 'Date' to the target. Exception setting "Date": "Cannot convert null to type "System.DateTime"."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:163 char:40
+                 $FormatDate =  Get-Date($ConvertToDate) -Format 'yyyy ...
+                                        ~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Get-Date], ParameterBindingException
    + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.GetDateCommand
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Get-Date : Cannot bind parameter 'Date' to the target. Exception setting "Date": "Cannot convert null to type "System.DateTime"."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:163 char:40
+                 $FormatDate =  Get-Date($ConvertToDate) -Format 'yyyy ...
+                                        ~~~~~~~~~~~~~~~~
    + CategoryInfo          : WriteError: (:) [Get-Date], ParameterBindingException
    + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.PowerShell.Commands.GetDateCommand
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 
Exception calling "ParseExact" with "3" argument(s): "String was not recognized as a valid DateTime."
At C:\Program Files\WindowsPowerShell\Modules\WindowsOSBuild\2202.1\WindowsOSBuild.psm1:161 char:21
+ ...             $ConvertToDate = [Datetime]::ParseExact($GetDate, 'MMMM d ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException
 


Version           : Version 21H2 (OS build 20348)
Build             : 20348.707
Availability date : 
Preview           : False
Out-of-band       : False
Servicing option  : LTSC
KB article        : KB5013944
KB URL            : https://support.microsoft.com/en-us/help/5013944
Catalog URL       : https://www.catalog.update.microsoft.com/Search.aspx?q=KB5013944




PS U:\> 

Not working on Server 2022 as expected

Unless im doing something really wrong, the Server 2022 is not working as intended, I think the main page doesnt provide the data for this OS.

PS C:\Windows\system32> Get-LatestOSBuild -OSName Server2022 -OSVersion 21H2 -LatestReleases 5

Version : Version 21H2 (OS build 19044)
Servicing option : LTSC • General Availability Channel
Availability date : 2021-11-22
Build : 19044.1387
KB article : KB5007253

Version : Version 21H2 (OS build 19044)
Servicing option : LTSC • General Availability Channel
Availability date : 2021-11-16
Build : 19044.1288
KB article :

These are the details for the OS

PS C:\Windows\system32> $CurrentBuild
20348.350

PS C:\Windows\system32> $OSVersion

Major Minor Build Revision


10 0 20348 0

that can be found here
https://support.microsoft.com/en-us/topic/november-9-2021-kb5007205-os-build-20348-350-af102e6f-cc7c-4cd4-8dc2-8b08d73d2b31

Get-LatestOSBuild -OSVersion "21H2" -OSName "Server2022" is broken

Hi, since a few weeks, the OS Build query for Windows Server 2022 is broken. As far as I can tell, it reports the build number of Windows Server vNext (23H2) instead.

Example:

PS C:\Users\WDAGUtilityAccount> Get-LatestOSBuild -OSVersion "21H2" -OSName "Server2022"

Version           : Version 21H2 (OS build 25398)
Build             : 25398.531
Availability date : 2023-11-14
Preview           : False
Out-of-band       : False
Servicing option  : LTSC
KB article        : KB5032202
KB URL            : https://support.microsoft.com/en-us/help/5032202
Catalog URL       : https://www.catalog.update.microsoft.com/Search.aspx?q=KB5032202

The correct build number as of today would be: 20348.2113

Source for 2022: https://support.microsoft.com/en-us/topic/windows-server-2022-update-history-e1caa597-00c5-4ab9-9f3e-8212fe80b2ee
Source for 23H2: https://support.microsoft.com/en-us/topic/november-14-2023-kb5032202-os-build-25398-531-e1ee8019-47f8-4314-be67-32d4e48ac140

Windows 11 Get-CurrentOSBuild -Detailed

Get-CurrentOSBuild -Detailed does not work for Windows 11:

$GetOSCaption = (Get-CIMInstance Win32_OperatingSystem).Caption returns "Microsoft Windows 11 Enterprise"

However $DetectedOS gets matched to "Win10" not "Win11"

ElseIf ($GetOSCaption -match "Windows 11") {
$DetectedOS = "Win10"
}

Which means no information is shown for Windows 11 when running: Get-CurrentOSBuild -Detailed

Thanks for a useful module.

Issues with Server 2022 with Hotpatch enabled

On Azure machines with hotpatch enabled this is not working.
https://support.microsoft.com/en-gb/topic/release-notes-for-hotpatch-in-azure-automanage-for-windows-server-2022-4e234525-5bd5-4171-9886-b475dabe0ce8

I tried and made something quick and dirty on our custom script to check if its autopatch or not and changing the url to be parsed

    ```

$hotpatchcheck = Get-HotFix -Id KB5003508 -ErrorAction SilentlyContinue
if ($hotpatchcheck) {
$URL = "https://support.microsoft.com/en-gb/topic/release-notes-for-hotpatch-in-azure-automanage-for-windows-server-2022-4e234525-5bd5-4171-9886-b475dabe0ce8"
}
Else {
$URL = "https://support.microsoft.com/en-us/help/5005454"
}


But even then, the webpage parse mechanism doesnt match what the OS reports

OS Build 20348.2091 --- correct info from the OS and correct info from the webpage body
OS Build 20346.2091 --- data pulled up from the module, and info from the table ?? 

Any ideas ?

Build only parameter fails

-BuildOnly parameter fails due to error on line 154 of WindowsOSBuild.psm1
Cause is the $Table member NoteProperty for "OS Build" is now "Build" after the update

eg it should be

($Table | Where-Object { $_ -Match "Version $OSVersion" } | Select-Object -First $LatestReleases)."Build"

Get-LatestOSBuild function doesn't work on Server Core

The following error is returned when you run the Get-LatestOSBuild function on Server Core.

Retrieving the COM class factory for component with CLSID {00000000-0000-0000-0000-000000000000} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)

This is due to the absence of the COM object 'HTMLFile' which is used to parse the release information. Internet Explorer is needed for this COM object to work and it is not installed on Server core.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.