Page 1 of 1 1
Topic Options
#64 - 1999-06-04 09:28 AM determine wich OS login
Anonymous
Unregistered


I want to write a script, wich determine
from wich OS is logged in.
in other words wheni log on from a win 98
client on a NT server i only want to execute
the commands in a label with that OS.
when i'm logging in at the server itself
only the commands in the server label may
be executed. the script has to determine from
wich OS be loggid in (Sorry for the bad english)



Top
#65 - 1999-06-07 04:54 PM Re: determine wich OS login
Anonymous
Unregistered


For Win98 Use:

if (readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","ProductName")="Microsoft Windows 98")=1
$OS="WIN98"
$OS1="Windows 98"
endif

For Win95 use:

if (readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","ProductName")="Microsoft Windows 95")
$OS="WIN95"
$OS1="Windows 95"
endif


For NT use:

if ("%OS%"="Windows_NT")....


Top
#66 - 2000-05-10 10:36 AM Re: determine wich OS login
Anonymous
Unregistered


Try this:

IF EXIST "C:\WINDOWS\SYSTEM\SOFTBOOT.EXE")
$OS = "Soft Windows:"
ENDIF

SELECT ; What OS are we running?
CASE ((@INWIN = 1) AND (@DOS = 5.0))
$OS = "Win2K"
CASE ((@INWIN = 1) AND (@DOS = 4.0))
$OS = "WinNT4"
CASE ((@INWIN = 2) AND (@DOS >= 4.10))
$OS = $OS + "Windows 98"
CASE ((@INWIN = 2) AND (@DOS = 4.0))
$OS = $OS + "Windows 95"
CASE 1
$OS = $OS + "UNDETERMINED"
ENDSELECT

Top
#67 - 2000-05-10 10:42 AM Re: determine wich OS login
Anonymous
Unregistered


You can also try this for a more complete solution:

IF EXIST "C:\WINDOWS\SYSTEM\SOFTBOOT.EXE")
$OS = "Soft Windows:"
ENDIF

$TempString=ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType")

SELECT
CASE @inwin=1 and $TempString<>"WinNT" and @dos=5.0
$OS = $OS + "Windows 2000 Server"
CASE @inwin=1 and $TempString="WinNT" and @dos=5.0
$OS = $OS + "Windows 2000 Professional"
CASE @inwin=1 and $TempString="LANMANNT"
$OS = $OS + "Windows NT 4.0 Domain Controller"
CASE @inwin=1 and $TempString="ServerNT"
$OS = $OS + "Windows NT 4.0 Member Server"
CASE @inwin=1 and $TempString="WinNT"
$OS = $OS + "Windows NT Workstation"
CASE ((@INWIN = 2) AND (@DOS >= 4.10))
$OS = $OS + "Windows 98"
CASE ((@INWIN = 2) AND (@DOS = 4.0))
$OS = $OS + "Windows 95"
CASE 1
$OS = $OS + "UNDETERMINED"
ENDSELECT

Top
#68 - 2000-05-10 11:27 AM Re: determine wich OS login
Manimal Offline
Getting the hang of it

Registered: 2000-04-04
Posts: 96
Loc: Oregon City, OR. USA
this is what I use - kudos to Bryce...

It gives the OSversion, subversion (a,b, etc) and Service Pack version

sdetect
$pp = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType")
$SubVer = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","SubVersionNumber")
$SPNbr = ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion")

select
Case @inwin=1 and $pp<>"WinNT" and @dos=5.0
$os="Windows 2000 Server"
Case @inwin=1 and $pp="WinNT" and @dos=5.0
$os="Windows 2000 Professional Workstation"
Case @inwin=1 and $pp="LANMANNT"
$os="Windows NT 4.0 $SPNbr Domain Controller"
Case @inwin=1 and $pp="ServerNT"
$os="Windows NT 4.0 $SPNbr Member Server"
Case @inwin=1 and $pp="WinNT"
$os="Windows NT 4.0 $SPNbr Workstation"
Case @inwin=2 and @dos="4.10"
$os="Windows 98 $Subver"
Case @inwin=2 and @dos="4.0"
$os="Windows 95 $Subver"
Case 1
$os="undetermined" ; This value will be set if no other EXACT match is made
endselect

_________________________
Chris Fricke
Clackamas County

Top
#69 - 2000-05-10 11:55 AM Re: determine wich OS login
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Can't recall who sent me that one. I can't take the credit for it, i just stuck it on my site

would the real author please step forward?

Bryce

Top
#70 - 2000-05-10 06:39 PM Re: determine wich OS login
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
that would be me...

Of course, I just assembled this info from others tips and suggestions.

Please no applause (just send money)

:-)

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#71 - 2000-05-10 06:55 PM Re: determine wich OS login
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
here is a newer version (lots of case statements) It should execute faster. I don't have this varied of an environment. Any debugging is welcome (especially the WinME section"

cls
select
Case @inwin=1
$kernel="WinNT"
$type=ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType")
select
Case @dos=5.0
$system="Win2k"
select
Case $type<>"WinNT"
$flavor="Server"
Case $type="WinNT"
$flavor="Professional"
endselect
Case @dos=4.0
$system="WinNT"
select
Case $type="LANMANNT"
$flavor="Domain Controller"
Case $type="ServerNT"
$flavor="Member Server"
Case $type="WinNT"
$flavor="Workstation"
endselect
endselect
$Svcpack=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","CSDVersion")
Case @inwin=2
$kernel="Win9x"
$SubVer=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","SubVersionNumber")
select
Case @dos="???"
$system="WinME"
$flavor="A"
Case @dos="4.10"
$system="Win98"
select
Case $subver=
$flavor="SE"
Case $subver="a"
$flavor="A"
endselect
Case @dos="4.0"
$system="Win95"
select
Case $subver=" C"
$flavor="OSR2.5"
Case $subver=" B"
$flavor="OSR2"
Case $subver="a"
$flavor="A"
endselect
endselect
$Svcpack=""
Case 1
$kernel="undetermined"
$system="undetermined"
$flavor="undetermined"
$Svcpack=""
endselect

? "Kernel type is "+$kernel
? "Operating System is "+$system $Svcpack
? "OS Flavor is "+$flavor

get $k ;Pauses script to view output

_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#72 - 2000-05-11 07:50 AM Re: determine wich OS login
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
great script!

Kernel type is WinNT
Operating System is Win2k
OS Flavor is Professional

Bryce

Top
#73 - 2000-11-15 09:22 PM Re: determine wich OS login
Anonymous
Unregistered


Any Idea's on detecting Windows NT terminal Server version 4
Top
#74 - 2000-11-15 09:44 PM Re: determine wich OS login
Anonymous
Unregistered


Radimus,

Your 'older' script is telling me wich flavor I'm using ( A ), the script in this thread is not.....:

code:

Kernel type is Win9x
Operating System is Win98
OS Flavor is

Hope this might help you with your debugging?

Cya,
Wam

Top
#75 - 2000-11-16 03:41 PM Re: determine wich OS login
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
try this thread
http://kixtart.org/board/Forum2/HTML/000760.html
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 327 anonymous users online.
Newest Members
Jojo67, MaikSimon, kvn317, kixtarts2025, SERoyalty
17873 Registered Users

Generated in 0.083 seconds in which 0.039 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org