wmic os get BuildNumber

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Jbcom41
Posts: 11
Joined: 20 Jun 2021 02:36

wmic os get BuildNumber

#1 Post by Jbcom41 » 01 Oct 2021 08:08

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"

Squashman
Expert
Posts: 4465
Joined: 23 Dec 2011 13:59

Re: wmic os get BuildNumber

#2 Post by Squashman » 01 Oct 2021 08:45

Is this a trick question?????

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

Compo
Posts: 599
Joined: 21 Mar 2014 08:50

Re: wmic os get BuildNumber

#3 Post by Compo » 01 Oct 2021 16:14

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.

Jbcom41
Posts: 11
Joined: 20 Jun 2021 02:36

Re: wmic os get BuildNumber

#4 Post by Jbcom41 » 02 Oct 2021 03:49

Thanks Compo, getting into DOS, its great language to learn, total newbie to dos but learning a lot here :) thanks again for the help...

Post Reply