Page 1 of 1 1
Topic Options
#64263 - 2002-04-06 06:46 PM GETTYPE for XP
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Does anybody know if this file exists out there for Windows XP and below? I know there is one for Windows 2000.

Thanks!

- Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#64264 - 2002-04-06 07:05 PM Re: GETTYPE for XP
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Kent,
I assume you are referring to the RK util GetType.exe and that the KiX macro @ProductType just won't do.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#64265 - 2002-04-06 09:29 PM Re: GETTYPE for XP
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Les,

Yes, I would like to detect 9x/NT/2k/XP via the NTLOGON.BAT File. Currently, under XP it bypasses all of it and leaves.

- Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#64266 - 2002-04-06 09:36 PM Re: GETTYPE for XP
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I belive you can use the DOS VER command for that piped to FIND.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#64267 - 2002-04-06 09:51 PM Re: GETTYPE for XP
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
What does the environment variable %OS% contain on an XP computer? I believe that it is "Windows_NT". That would be the same as NT and Windows 2000.

Try this older version of batch file from my archive. I think that this is what you want with minimal overhead.
code:
IF '%OS%'=='Windows_NT' GOTO HWchk
SET windir=
SET winbootdir=
IF '%windir%'=='' SET OS=DOS
IF '%OS%'=='' IF '%winbootdir%'=='' SET OS=Windows_3.x
IF '%OS%'=='' SET OS=Windows_95
IF '%OS%'=='Windows_95' GOTO Win95

:HWchk
IF '%PROCESSOR_ARCHITECTURE%'=='x86' GOTO WinNT
echo PROCESSOR_ARCHITECTURE=%PROCESSOR_ARCHITECTURE% >>%TEMP%\Logon.log
goto End

:Win311
echo Windows 3.11 is not supported!
pause
goto End

:WinNT
date<nul >>%TEMP%\Logon.log
echo. >>%TEMP%\Logon.log
time<nul >>%TEMP%\Logon.log
echo. >>%TEMP%\Logon.log
set COPYCMD=/Y
IF NOT exist %systemroot%\kix32.exe echo Copying Kixtart files.
xcopy %0\..\kix32\kix32.exe %systemroot%\ /D 1>nul 2>>%TEMP%\Logon.log
if errorlevel 1 echo An error occurred while copying kix32.exe.
echo %systemroot%\kix32.exe %0\..\corp.kix >>%TEMP%\Logon.log
%systemroot%\kix32.exe %0\..\corp.kix
goto End

:Win95
IF NOT exist %winbootdir%\kix32.exe echo Copying Kixtart files.
xcopy %0\..\kix32\kix32.exe %winbootdir%\ /D >>%TEMP%\Logon.log
if errorlevel 1 echo An error occurred while copying kix32.exe.
xcopy %0\..\kix32\kx32.dll %winbootdir%\ /D >>%TEMP%\Logon.log
if errorlevel 1 echo An error occurred while copying kx32.dll.
xcopy %0\..\kix32\kx16.dll %winbootdir%\ /D >>%TEMP%\Logon.log
if errorlevel 1 echo An error occurred while copying kx16.dll.
xcopy %0\..\kix32\kx95.dll %winbootdir%\ /D >>%TEMP%\Logon.log
if errorlevel 1 echo An error occurred while copying kx95.dll.
echo. >>%TEMP%\Logon.log
echo Finish Xcopy >>%TEMP%\Logon.log
echo. >>%TEMP%\Logon.log
echo %winbootdir%\kix32.exe %0\..\corp.kix >>%TEMP%\Logon.log
%winbootdir%\kix32.exe %0\..\corp.kix
goto End
<br>
:END
echo End of corp_v1.bat >>%TEMP%\Logon.log

{edit}
I am guessing that you only need to differentiate Win9x from the other so that you copy the right files or something similar. Once the Kixtart script starts you can differentiate more finely.

[ 06 April 2002, 22:08: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#64268 - 2002-04-06 10:00 PM Re: GETTYPE for XP
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
While I don't have XP to play with, I do believe that %OS% = Windows_NT on all three vesions, NT, 2K, and XP. The DOS VER command however should give you better granularity. For exanple, to identify W2K, this does the trick.

ver | find /c "5.00"

Doesn't XP return "5.1" or something like that?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#64269 - 2002-04-06 10:09 PM Re: GETTYPE for XP
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I should have just replied, but instead edited my note.

I am guessing that there is only a need to differentiate Win9x from the other so that you copy the right files or something similar. Once the Kixtart script starts you can differentiate more finely.

I do not not see a need for a fine determination prior to the Kixtart script execution.

[ 06 April 2002, 22:10: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#64270 - 2002-04-07 01:14 AM Re: GETTYPE for XP
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Howard,

With Terminal Server, you may not want to run Kix Scripts. Over DUN, you may not either. So.. Going "fine" with the detection is acceptable before running Kix.

You really could do something like:
code:
@echo off
VER | find "XP" > nul
IF not errorlevel 1 GOTO :s_win_XP

VER | find "NT" > nul
IF not errorlevel 1 GOTO :s_win_NT

VER | find "2000" > nul
IF not errorlevel 1 GOTO :s_win_2000

VER | find "Millennium" > nul
IF not errorlevel 1 GOTO :s_win_me

VER | find "98" > nul
IF not errorlevel 1 GOTO :s_win_98

VER | find "95" > nul
IF not errorlevel 1 GOTO :s_win_95
GOTO :s_unknown_os

:s_win_XP
Echo you are running XP
SET OS = WINXP
goto t_server_chk

:s_win_NT
Echo you are running NT
SET OS = WINNT
goto t_server_chk

:s_win_2000
Echo you are running 2000
SET OS = 2000
goto t_server_chk

:s_win_me
Echo you are running ME
goto end

:s_win_98
Echo you are running 98
goto end

:s_win_95
Echo you are running 95
goto end

:s_unknown_os
Echo you are running a unknown OS
goto end

:t_server_chk
net start | find "Terminal" > nul
IF not errorlevel 1 SET TSer = YES
IF TSer = Yes Echo %OS% and Terminal Server
IF NOT TSer = Yes Echo %OS%
goto end

:end

I also found this bit of interesting info..

http://www.ultratech-llc.com/KB/?File=OSType.TXT

L8r,

- Kent

[ 07 April 2002, 01:18: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#64271 - 2002-04-07 01:29 AM Re: GETTYPE for XP
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Thanks for the keeping a broad outlook. I have Kixtart scripts execute at every logon regardless of DUN or Terminal Server. All of my code except for my batch file (3,268 bytes) and an init bootstrap kixtart program (885 bytes) executes from the local hard drive. At times my own environment gives me tunnel vision.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#64272 - 2002-04-07 01:33 AM Re: GETTYPE for XP
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Kinda interesting..

I just ran GETTYPE under XP (from Windows 2000).

The %errorlevel% is: 4238624

- Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#64273 - 2002-04-07 01:36 AM Re: GETTYPE for XP
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I just did some digging from a post I did on a newsgroup a bit ago...

code:
if /i %OS% == Windows_NT goto WINNT
GOTO :WIN9X

:WINNT
SET SYSDIR=%WINDIR%\SYSTEM32
VER | FIND /I "2000" > NUL
IF NOT %ERRORLEVEL% EQU 1 GOTO IS2000
VER | FIND /I "NT" > NUL
IF NOT %ERRORLEVEL% EQU 1 GOTO ISNT

:IS2000
SET $A = XCOPY /Y
Set Type=S&net start |find "Terminal" && set Type=T && goto FILECHK
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#64274 - 2002-04-07 01:38 AM Re: GETTYPE for XP
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
I just did some digging from a post I did on a newsgroup a bit ago...

code:
if /i %OS% == Windows_NT goto WINNT
GOTO :WIN9X

:WINNT
SET SYSDIR=%WINDIR%\SYSTEM32
VER | FIND /I "2000" > NUL
IF NOT %ERRORLEVEL% EQU 1 GOTO IS2000
VER | FIND /I "NT" > NUL
IF NOT %ERRORLEVEL% EQU 1 GOTO ISNT

:IS2000
SET $A = XCOPY /Y
Set Type=S&net start |find "Terminal" && set Type=T && goto FILECHK
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#64275 - 2002-04-07 01:42 AM Re: GETTYPE for XP
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Shoot...

Went into my XP Pro install and see that Terminal Services is installed.

[Frown] [Frown]

- Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#64276 - 2002-04-07 06:05 AM Re: GETTYPE for XP
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Yeah, that's the best part of XP.

The only thing I check for in my logon.bat is RAS, NT, and Wintendo. For my purposes, NT and 2K are the same. Everything else (servers, admin rights, Terminal Server, etc.) I do from KiX.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#64277 - 2002-04-07 08:01 AM Re: GETTYPE for XP
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
This is a batch file I posted about 6 months ago, it is similar to what you have alredy found.

code:
@ECHO OFF
IF NOT "%OS%" == "Windows_NT" GOTO WIN9X
VER|FIND /I "XP" >NUL && IF %ERRORLEVEL% EQU 0 GOTO XP
IF not "%ALLUSERSPROFILE%" == "" GOTO WIN2K
IF "%OS%" == "Windows_NT" GOTO NT4
GOTO END
:XP
ECHO Found Windows XP
REM Or what ever command you want to run.
GOTO END
:WIN2K
ECHO Found Windows 2000
REM Or what ever command you want to run.
GOTO END
:NT4
ECHO Found Windows NT 4
REM Or what ever command you want to run.
GOTO END
:WIN9X
ECHO Found Windows 9x
REM Or what ever command you want to run.
GOTO END
:END


Top
#64278 - 2002-04-07 09:47 AM Re: GETTYPE for XP
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Doc,

You are pretty close.. However, there needs to be detection for Terminal Services like Citrix..

You mentioned:

"%ALLUSERSPROFILE%"

I beleive under Citrix, it is called something like - "%CLIENTPROFILE%".

Hmm.. Time for more digging.

This all stems from my installing XP on my work system.

- Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#64279 - 2002-04-07 11:09 AM Re: GETTYPE for XP
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well I have never run Citrix...

Do you have or know of either a file or DOS variable that is present on Citrix clients?

Top
#64280 - 2002-04-07 05:53 PM Re: GETTYPE for XP
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well... in Win2K TS at least there are two env vars.

%CLIENTNAME%
%SESSIONNAME%

Since XP has TS built-in, it may sport the same vars. That's where the KiX macro @ProductSuite comes into play. It is best suited to ferret out whether or not the TS is "Single User Terminal Server".

I don't follow why you can't do it in KiX and just exit the script if you don't want it to run.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#64281 - 2002-04-08 12:30 AM Re: GETTYPE for XP
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Here are the variables from a Citrix MetaFrame server.

CLIENTNAME=BULLOCKHA
COMPUTERNAME=PRODMF08
WINSTATIONNAME=ICA-tcp#256

Here are the variables from a W2K Terminal Server session.

ALLUSERSPROFILE=C:\Documents and Settings\All Users
CLIENTNAME=BULLOCKHA
COMPUTERNAME=AMDC004
SESSIONNAME=RDP-Tcp#19

Note: ALLUSERSPROFILE did not exist in the Citrix session.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#64282 - 2002-04-08 08:15 PM Re: GETTYPE for XP
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
So then, I would assume that you could look for and make sure these variables are not blank.

WINSTATIONNAME
SESSIONNAME

IF %WINSTATIONNAME%="" GOTO etc....
IF %SESSIONNAME%="" GOTO etc....

Or something like this. You would need to test and play with it some to make sure it works on all of them.

Then just add them to the previous batch file and test on all permutations and you should then be able to determine what system your on via a DOS Batch call.

[ 08 April 2002, 20:16: Message edited by: NTDOC ]

Top
Page 1 of 1 1


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

Who's Online
0 registered and 1680 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.181 seconds in which 0.129 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