Page 1 of 1 1
Topic Options
#123048 - 2004-07-15 06:06 PM Kixtart Receive Variable from Batch File
Lobo Offline
Lurker

Registered: 2004-07-15
Posts: 3
Running Kixtart Version 3.60. Trying to determine OS version so that my login script won't run on Servers.

The version of Kix that we are using only has a function for determining if the OS is winnt or not, which doesn't work because xp and 2000 ws are winnt. It looks like this issue was addressed in later versions of Kix, but I am knee deep in the issue with 3.60 now.

Anyway, I think the solution is to run a batch file and return the variable back to script. The batch file that I have prepared is as follows:

****
@echo off
REM Batch file to detect OS
REM ----------------------------------
if Windows_NT == %OS% goto WINNT
echo old
goto END

:WINNT
gettype.exe

if errorlevel=9 goto FILENOTFOUND


if ERRORLEVEL=8 goto EIGHT
if ERRORLEVEL=7 goto SEVEN
if ERRORLEVEL=6 goto SIX
if ERRORLEVEL=5 goto FIVE
if ERRORLEVEL=4 goto FOUR
if ERRORLEVEL=3 goto THREE
if ERRORLEVEL=2 goto TWO
if ERRORLEVEL=1 goto ONE

:FILENOTFOUND
echo.
echo Gettype not found.
echo.
goto END

:EIGHT
echo Server
goto END

:SEVEN
echo Server
goto END

:SIX
echo Server
goto END

:FIVE
echo Server
goto END

:FOUR
echo Server
goto END

:THREE
echo Server
goto END

:TWO
echo Workstation
goto END

:ONE
echo Workstation
goto END

:END
pause
*******

Now what I am looking for is for:
1. How to call the batch file from Kix;
2. How to get the variable of workstation, server or old back into Kix;
3. Then I believe that if I have it back in I can just do an if statement with a goto?

Thanks for any help on this.

Top
#123049 - 2004-07-15 06:37 PM Re: Kixtart Receive Variable from Batch File
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Try giving this shot, it's what we use for our logon script which is still at 3.63 i believe

Code:

;*************************************************************
:_DetectOS
;This will determine the exact Operating System of a machine.
;Returns OS Type
$_ProductType = ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType")
SELECT
CASE @INWIN = 1 AND $_ProductType = "WinNT" AND @DOS=5.1
$LibraryRet1 = "WinXP Professional"
$LibraryRet2 = "Client"
CASE @INWIN = 1 AND $_ProductType <> "WinNT" AND @DOS=5.0
$LibraryRet1 = "Win2k Server"
$LibraryRet2 = "Server"
CASE @INWIN = 1 AND $_ProductType = "WinNT" AND @DOS=5.0
$LibraryRet1 = "Win2k Professional"
$LibraryRet2 = "Client"
CASE @INWIN = 1 AND $_ProductType = "ServerNT"
$LibraryRet1 = "WinNT Server"
$LibraryRet2 = "Server"
CASE @INWIN = 1 AND $_ProductType = "WinNT"
$LibraryRet1 = "WinNT Workstation"
$LibraryRet2 = "Client"
CASE @INWIN = 2 AND @DOS = "4.10"
$LibraryRet1 = "Win98"
$LibraryRet2 = "Client"
CASE @INWIN = 2 AND @DOS = "4.0"
$LibraryRet1 = "Win95"
$LibraryRet2 = "Client"
CASE 1
$LibraryRet1 = "Unknown operating system"
$LibraryRet2 = "No Known Function"
ENDSELECT
RETURN


_________________________
Eric

Top
#123050 - 2004-07-15 06:54 PM Re: Kixtart Receive Variable from Batch File
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
3.60 is a pretty old version! It is certainly possible to pass parms through the commandline. The manual explains it. Why are you running such an old version anyway?

Borrowing from the 3.60 manual:
Quote:

KiXtart also supports declaring variables at the command prompt, demonstrated in the following example:

kix32 Demo.kix $Key=HKEY_LOCAL_MACHINE\Software
For information about valid variable names and values, see “Dynamic Program Variables” later in this document.



_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#123051 - 2004-07-15 07:40 PM Re: Kixtart Receive Variable from Batch File
Lobo Offline
Lurker

Registered: 2004-07-15
Posts: 3
Let me try both of these.

Old Version: I just took over the Network Admin and I have the script rewritten into my home language (vbscript), but the implementation is 2 months off......and we need the OS determine asap because of a TS implementation.

Thanks for help, i'll let ya'll know how it turns out.

Top
#123052 - 2004-07-15 09:37 PM Re: Kixtart Receive Variable from Batch File
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
To subvert the script for a TS logon, you could simply set an environment var on the TS and check for it in the script. No need to get fancy.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#123053 - 2004-07-15 11:07 PM Re: Kixtart Receive Variable from Batch File
Lobo Offline
Lurker

Registered: 2004-07-15
Posts: 3
maciep was the winner. Couple of tweaks to include 2k3 (even though it worked, I didn't feel like getting questions on why it wasn't in there) and it works like a charm. Thanks guys, if your ever in Atlanta.....beers on me.
Top
#123054 - 2004-07-18 05:19 PM Re: Kixtart Receive Variable from Batch File
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
See also the OSID() UDF.
_________________________
There are two types of vessels, submarines and targets.

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 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.075 seconds in which 0.043 seconds were spent on a total of 12 queries. Zlib compression enabled.

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