Detection of operating system.

I need to import a registry setting into windows 9x, NT and 2000 machines but the logon script will need to detect the OS to import the correct reg file.
Does anyone know of any files that only exists on 2000 & NT & 9x machines that I can 'IF Exist' on.
bluematterAsked:
Who is Participating?
 
ToniVRCommented:
Detecting the OS by files? Will be tricky.

Win98 only has msconfig.exe
WinNT has bootnt.???

I think you better write a small app that detects the system, and call it in your script. That will be the easiest.

0
 
ToniVRCommented:
You mean by script? Check for the system directory under the windows map.
0
 
bluematterAuthor Commented:
Sorry.. Yes by script. I need to differentiate between the 3 OS's. (All three OS's have a system & system32 directory under the windows map. Even so you can't IF EXIST to directories)
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
vsamtaniCommented:
NT and 2000 have cmd.exe, and 9x have command.com. I would also examine the environment variables on each OS (by typing set in a command prompt). COMSPEC and OS will certainly differentiate NT from 9x - I'm not sure what 2000 has, since I don't have access to one at this moment.

Vijay

0
 
ToniVRCommented:
checked the OS and COMSPEC on 2000, are the same as NT 4.0
0
 
gmichelsCommented:
*thinking*
What if the machine dual boots? They will have both. Will your script handle them, too?
0
 
ToniVRCommented:
gmichels, normally dual boot OS'es have their own partition, so that can be solved
0
 
gmichelsCommented:
Normally but you can put both on the same partition (C:\windows and c:\winnt).
I just want to point that out to be sure he considers that in his script.  :-)


0
 
gmichelsCommented:
Also, what about just using the kernels as the reference? Will it be able to look for hidden files in the search?
0
 
bluematterAuthor Commented:
In the end folks I used an app I found deep in the depths of the 2000RK called gettype that detects currently running OS (Dual boot sorted) and gives an error level number.  Which is well handy because the reg hawke I needed to import was to set Browser Elections and the like.  So this protects my PDC/BDC's
Thanks anyway chaps/chapets ;o)
 Returns 1 for Windows NT Workstation.
 Returns 2 for Windows 2000 Professional installation.
 Returns 3 for Windows NT Server Non-Domain Controller.
 Returns 4 for Windows 2000 Server Non-Domain Controller.
 Returns 5 for Windows NT Server Domain Controller.
 Returns 6 for Windows 2000 Server Domain Controller.
 Returns 7 for Windows NT [Enterprise/Terminal] Server Domain Controller
 Returns 8 for Windows NT [Enterprise/Terminal] Server Non-Domain Controller
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.