Page 1 of 1 1
Topic Options
#145678 - 2005-08-16 03:51 PM Detect if user is logging into a server or workstation
kevinz Offline
Lurker

Registered: 2005-08-16
Posts: 2
I plan to use a kix logon script to install the Veritas Backupexec DLO. This program is only compatible with workstations and throws an error when installation is attempted on a server.

How can I have kix determine if the user is logging into Win XP, Win 2000 Pro, Win Server 2003, or Win 2000 Server?

Thanks

Top
#145679 - 2005-08-16 03:55 PM Re: Detect if user is logging into a server or workstation
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Look in the back of the manual for the @PRODUCTSUITE and @PRODUCTTYPE macros.
Top
#145680 - 2005-08-16 04:44 PM Re: Detect if user is logging into a server or workstation
KLank Offline
Lurker

Registered: 2003-01-03
Posts: 1
Loc: Central CT
Quote:


This program is only compatible with workstations and throws an error when installation is attempted on a server.





The following will exit your script if running on a server.

Code:

If (InStr(UCase(@PRODUCTTYPE), 'SERVER') OR (InStr(UCase(@PRODUCTTYPE), 'DOMAIN')
; Running on a server
Exit
EndIf


Top
#145681 - 2005-08-16 05:28 PM Re: Detect if user is logging into a server or workstation
Richard H. Administrator Offline
Administrator
*****

Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
Don't use "Exit" or "Quit" without a value. I know the manual says it is optional, but it isn't. It will kind of work most of the time, but then sometimes it won't, and your script will behave unexpectedly.

I approve of the UCase(), even though for most people it is redundant as we hardly ever switch the CaseSensitivity option on.

Top
#145682 - 2005-08-16 06:11 PM Re: Detect if user is logging into a server or workstation
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
No need for the exit and ucase when done like this. More readable I think (at least to me it is).
Also Windows 2003 server Domain Controller exists so the extra case is added. If you just do $type = "1" or $type2 = "1" as far as I can test right now it will fail and install the veritas tool. Because both will be true.

Code:

$type1 = InStr(@PRODUCTTYPE, "Server")
$type2 = InStr(@PRODUCTTYPE, "Domain")

Select
Case $type1 = "1"
;Running on a server nothing.
Case $type2 = "1"
;Running on a domain controller do nothing.
Case 1
Shell "\\someserver\someshare\Veritas Backupexec DLO installer thingie.EXE"
EndSelect



Edited by Mart (2005-08-16 06:16 PM)
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#145683 - 2005-08-16 07:04 PM Re: Detect if user is logging into a server or workstation
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Code:
Dim $IsServer
$IsServer = ReadValue('HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions','ProductType')
If $IsServer<>'WinNT' ; System is a server
Exit 1
Else
;Run installer for Workstation
EndIf


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
1 registered (mole) and 1441 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.055 seconds in which 0.025 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