Wednesday, May 11, 2011

Get Windows Kernel Version from Command Prompt using WMIC

I got a task to get the windows kernel version using a command. There are lot of options available like

winver command from command line, systeminfo etc but none of them give the detailed version I'm looking for.

By detailed version, I mean something like this
6.0.6001.18538

After a lot of search, got this command:
WMIC DATAFILE WHERE "Name='c:\\windows\\system32\\ntoskrnl.exe'" Get Version

This works well.. If you are looking for a T-SQL then here it is
xp_cmdshell 'WMIC DATAFILE WHERE "Name=''c:\\windows\\system32\\ntoskrnl.exe''" Get Version'