General discussion

Locked

Batch file to determine which NT Version

By joshhansen ·
I need to know how to figure out which version of NT a PC is using through a batch file. I know about the OS= variable but it it shows the same version if you use NT 4 or Windows 2k. Is there another variable that gives more specific info?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

Batch file to determine which NT Version

by billc124 In reply to Batch file to determine w ...

Have you tried using the VER command? It should tell you the version of Windows you are using.

Collapse -

Batch file to determine which NT Version

by joshhansen In reply to Batch file to determine w ...

Remember I need to have the batch file determine the version.

Collapse -

Batch file to determine which NT Version

by Joseph Moore In reply to Batch file to determine w ...

Ok, here you go.
This is a BAT file that will collect the IP address of the machine, the Windows version, the logged-in user name running the BAT file, and it will append all of this to a single text file. You can put this in a logon script for all of your users to use, and point it to a central share. This BAT will make a separate text file per user name. So, you will get separate files per user.
Here is the BAT file contents (call it NTVER.BAT):

@ECHO OFF
cls
ipconfig >> %username%.txt
ver >> %username%.txt
echo %username% >> %username%.txt
echo ********************* >> %username%.txt

And for me, it will make a text file called JOE.TXT that contained the following:


Windows NT IP Configuration


Ethernet adapterACC07D1:


IP Address. . . . . . . . . : 10.1.1.211

Subnet Mask . . . . . . . . : 255.255.255.0

Default Gateway . . . . . . : 10.1.1.1


Windows NT Version 4.0
JMO
*********************

I added the "****" just for fun!

Now, you can have each line of the BAT write to the same file, to append all your users into one big file. (that is why the ***** are useful)

So, either add this to an existing logon script, just run it as a BAT manually, or call it from a logon script by doing a CALL NTVER.BAT from the logon script.

Hope this helps.

Collapse -

Batch file to determine which NT Version

by Joseph Moore In reply to Batch file to determine w ...

I forgot:
The secret to appending to the same text file is the ">>". If you did a single carat, ">" it would OVERWRITE.
But the double carat, ">>" APPENDS.

Just a little old DOS syntax.

Collapse -

Batch file to determine which NT Version

by Joseph Moore In reply to Batch file to determine w ...

Actually, the text file it made is called JMO.TXT
Sorry, I wasn't thinkin'!

Collapse -

Batch file to determine which NT Version

by joshhansen In reply to Batch file to determine w ...

Poster rated this answer

Collapse -

Batch file to determine which NT Version

by billc124 In reply to Batch file to determine w ...

Just a comment. All you asked for was the variable to give you the version of NT. I gave you that. If you wanted more specific information you should have asked for it.

Collapse -

Batch file to determine which NT Version

by joshhansen In reply to Batch file to determine w ...

Poster rated this answer

Collapse -

Batch file to determine which NT Version

by FaisalMasood In reply to Batch file to determine w ...

Joseph Moore, your script works nicely. I've used it in this way with one more option to save the computer name using HOSTNAME command.


@ECHO OFF
cls
Echo off
ipconfig >> %username%.txt
ver >> %username%.txt
hostname >> %username%.txt
echo %username% >> %username%.txt
echo The home drive is %HOMEDRIVE% >> %username%.txt
echo *************************************************** >> %username%.txt


Actually I want to use this script to track which user is logging on from which machine & which Id they are using. Actually users here are trying to access things not allowed to them using others accounts / machines.

So my only hope to track them is using this script. But this script saves the %username%.txt file in the root oof their boot partition.

Is there any way using this script to save the file on my server without giving user access to those file.

Collapse -

Batch file to determine which NT Version

by joshhansen In reply to Batch file to determine w ...

Poster rated this answer

Related Discussions

Related Forums