PowerShell: Get Windows Build Number
Need to check the exact Windows build number for compatibility checks, feature availability, or troubleshooting an update issue? This one-liner pulls it straight from the OS.
Prerequisites:
- Privileges: None
- Module: Built-in, no import needed
Quick Command:
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object BuildNumber
Example Output:
BuildNumber
-----------
22631
📦
Want all of them at once?
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
Get every free one-liner from this blog in a single downloadable bundle organized by category, each with full comment-based help. No more copy-pasting one at a time.
How It Works:
- Get-CimInstance -ClassName Win32_OperatingSystem queries the operating system class through CIM/WMI, which holds core system details like version, architecture, install date, and build info.
- BuildNumber returns the specific Windows build (e.g. 22631 for a Windows 11 23H2 release), which is more precise than just the marketing version name and is often what you need to confirm a specific update or feature is present.
- Select-Object trims the output down to just this one property, since Win32_OperatingSystem also returns a lot more data (like Caption, Version, OSArchitecture, or InstallDate) that isn't needed for a quick build check.
🛡️
Need help with your infrastructure?
If you're stuck or need a hand automating your environment, drop me an email at filipkonopik@gmail.com and we can take a look at it together.
If you're stuck or need a hand automating your environment, drop me an email at filipkonopik@gmail.com and we can take a look at it together.