#64263 - 2002-04-06 06:46 PM
GETTYPE for XP
|
Kdyer
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
|
|
Top
|
|
|
|
#64265 - 2002-04-06 09:29 PM
Re: GETTYPE for XP
|
Kdyer
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
|
|
Top
|
|
|
|
#64267 - 2002-04-06 09:51 PM
Re: GETTYPE for XP
|
Howard Bullock
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 ]
|
|
Top
|
|
|
|
#64269 - 2002-04-06 10:09 PM
Re: GETTYPE for XP
|
Howard Bullock
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 ]
|
|
Top
|
|
|
|
#64270 - 2002-04-07 01:14 AM
Re: GETTYPE for XP
|
Kdyer
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 ]
|
|
Top
|
|
|
|
#64271 - 2002-04-07 01:29 AM
Re: GETTYPE for XP
|
Howard Bullock
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.
|
|
Top
|
|
|
|
#64272 - 2002-04-07 01:33 AM
Re: GETTYPE for XP
|
Kdyer
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
|
|
Top
|
|
|
|
#64273 - 2002-04-07 01:36 AM
Re: GETTYPE for XP
|
Kdyer
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
|
|
Top
|
|
|
|
#64274 - 2002-04-07 01:38 AM
Re: GETTYPE for XP
|
Kdyer
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
|
|
Top
|
|
|
|
#64275 - 2002-04-07 01:42 AM
Re: GETTYPE for XP
|
Kdyer
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.
- Kent
|
|
Top
|
|
|
|
#64277 - 2002-04-07 08:01 AM
Re: GETTYPE for XP
|
NTDOC
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
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
|
|
Top
|
|
|
|
#64281 - 2002-04-08 12:30 AM
Re: GETTYPE for XP
|
Howard Bullock
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.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 292 anonymous users online.
|
|
|