Page 1 of 1

wmic os get BuildNumber

Posted: 01 Oct 2021 08:08
by Jbcom41
Hi Folks

I have got my script working great with the help from users on DosTips, (thanks so much to Compo) only one piece of the jig saw left and that is to get the build number, but just not sure how to go about that, can someone please help? see script below. any info would be greatly appreciated

Many Thanks

John

Code: Select all

@SetLocal EnableExtensions
@For /F Tokens^=6-10^ Delims^=^" %%G In ('
 (	Echo(NICConfig Where IPEnabled^='TRUE' Get IPAddress /Format:MOF ^&
	Echo(BIOS Get Get BuildNumbe /Format:MOF ^&
	Echo(BIOS Get SerialNumber /Format:MOF ^&
	Echo(CSProduct Get Name /Format:MOF^) ^| %SystemRoot%\System32\wbem\WMIC.exe
') Do @If "%%K" == "" (If Defined SN (Set "PC=%%G") Else Set "SN=%%G"
) Else Set "IP=%%I"
@(	Echo Event,Date,Time,Device,User,IP,SN,Model,Build
	Echo Login,%DATE%,%TIME:~,8%,%COMPUTERNAME%,%USERNAME%,%IP%,%SN:~,20%,%PC%
) 1>"//PC500/Source/%RANDOM%.csv"

Re: wmic os get BuildNumber

Posted: 01 Oct 2021 08:45
by Squashman
Is this a trick question?????

Your thread title is the exact code that gets the operating system build number.

Re: wmic os get BuildNumber

Posted: 01 Oct 2021 16:14
by Compo
Squashman wrote:
01 Oct 2021 08:45
Is this a trick question?????

Your thread title is the exact code that gets the operating system build number.
And just to be a little less cryptic; I suppose the first thing you should do is to review your own code, and fix your obvious typo's.

Changing

Code: Select all

BIOS Get Get BuildNumbe
to

Code: Select all

OS Get BuildNumber
would be a reasonable start!

Once you've done that, you'll need to adjust your If Else statements, and you need to remember that the code will not work if a single unit does not have one of the values.

Re: wmic os get BuildNumber

Posted: 02 Oct 2021 03:49
by Jbcom41
Thanks Compo, getting into DOS, its great language to learn, total newbie to dos but learning a lot here :) thanks again for the help...