This works but requires rather a lot of code and there’s no guarantee those DLLs will be updated or even exist in future versions of Windows. System Dllsĭirectly importing system DLLs, typically kernel32.dll or ntdll and reading the version information. To capture the output you either have to test the errorlevel or parse the string output. VER also works in all OS’s but as an internal CMD command it has to be run within CMD. SystemInfo works in all OS’s but as a CMD utility you will have to parse the string output with FOR. (Get-WmiInstance is an older and much slower version which predates the CIM* cmdlets, Get-WmiInstance works in PowerShell 1.0 and 2.0 but is deprecated in v3.0+ and not available at all in PowerShell 6.0) SystemInfo Get-CimInstance like all the CIM cmdlets is particularly useful for querying remote machines, just add the -computername option. Get-CimInstance works in all OS’s and requires PowerShell 3.0+ However this is quite slow and requires setting up PS Remoting so a faster and easier alternative is to use CIM as described below. The ReleaseID is now deprecated and will return '2009' for 20H2 and all subsequent versions of Windows. Read the build/releaseID (1803,1909, 20H2 etc) from the registryįor Windows 10 up to May 2020 / 2004, this can be retrieved via the ReleaseID key: $release = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseIdįor all later versions, this can be retrieved via the DisplayVersion key: $ver = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name DisplayVersion).DisplayVersion This returns most of the version info you could need, but will not work in old versions of Windows, requires PowerShell 5.0+. Get-ComputerInfo OsName,OsVersion,OsBuildNumber,OsHardwareAbstractionLayer,WindowsVersion Within PowerShell there are several different options for returning the OS version in Windows 10: Get-ComputerInfo How-to: Find the Operating System version.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |