Page 1 of 1 1
Topic Options
#112700 - 2004-01-28 07:08 PM Using @PRODUCTTYPE
BloggingITGuy Offline
Fresh Scripter

Registered: 2002-12-04
Posts: 6
This is what happens when I only write a logon script every 2 years or so. I forget how I did things the last time:

I'm trying to use If statements to get the script to check the @PRODUCTTYPE and to Run a process if there is a match.

Here's an example of my code (after looking at other examples, I realize that it's pretty amateurish, but I don't quite get the use of variables yet):

; This first portion tries to see if the OS is any version
; of Windows Server - Would like to know a more elegant way
; of doing this...By elegant I mean one that works
If @PRODUCTTYPE <> "Windows 98" OR @PRODUCTTYPE <> "Windows XP Professional"
QUIT
ENDIF

; Here I'm testing to see if the Workstation is a specific
; one and running an application if it isn't - Although
; I just read in the FAQ that it's better to change the
; LPO to force scripts to run before Explorer starts
:WORLDOXMIRROR
If @WKSTA <> "TETSUO" OR @WKSTA <> "VELMA"
RUN "C:\WORLDOX\WDMIRROR.EXE /a"
ENDIF

; Here I'm checking to see if the PC name is specific and
; running an app if it is
:WORLDOXINDEXER
If @WKSTA = "VELMA"
RUN "G:\WORLDOX\WDMIRROR.EXE /w8index /s=FK"
ENDIF

Needless to say that these bits of script are not currently working, or I wouldn't be writing this post.

Any help and explanation of said help would be most humbly appreciated.

Hmm...looks like this post might have been better put in Starters.


Edited by THX (2004-01-28 07:11 PM)

Top
#112701 - 2004-01-28 07:19 PM Re: Using @PRODUCTTYPE
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Your first two IF conditions will not work as it will always evaluate to FALSE. The correct IF conditions would use an AND instead of an OR.

See also the OSID() UDF for more granular OS detection.

_________________________
There are two types of vessels, submarines and targets.

Top
#112702 - 2004-01-28 07:24 PM Re: Using @PRODUCTTYPE
BloggingITGuy Offline
Fresh Scripter

Registered: 2002-12-04
Posts: 6
OK, is there also a thread that gives me good examples of how to use AND and OR in IF statements?

Because I was thinking that if you did an IF blah and bleh that both blah and bleh had to be met before the IF statement would be true. Whereas if you did IF blah or bleh then either blah or bleh could be true.

What am I missing there?

Top
#112703 - 2004-01-28 08:01 PM Re: Using @PRODUCTTYPE
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
You are correct...

If @PRODUCTTYPE <> "Windows 98" OR @PRODUCTTYPE <> "Windows XP Professional"

when @PRODUCTTYPE equals Windows 98"

@PRODUCTTYPE <> "Windows 98" results to 0
@PRODUCTTYPE <> "Windows XP Professional" result to 1

OR'ing these always returns TRUE

AND'ing this would return FALSE if the OS was either Windows 98 or Windows XP Professional


To find out if the computer is a server product try looking at these:
Code:
Function IsDomainController()
if InStr($ProductType,"Domain Controller")
$IsDomainController = 1
else
$IsDomainController = 0
endif
Endfunction

Function IsMemberServer()
if InStr($ProductType,"Server")
$IsMemberServer = 1
else
$IsMemberServer = 0
endif
Endfunction

Function IsNonServer()
if not (IsMemberServer() or IsDomainController())
$IsNonServer = 1
else
$IsNonServer = 0
endif
Endfunction




If @WKSTA <> "TETSUO" OR @WKSTA <> "VELMA"

will alway be true for the same reason as above.

If you want the IF top be TRUE only when the computer name is not TETSUO and not VELMA, you need to AND the conditions.

If the computer name is "VELMA".
@WKSTA <> "TETSUO" is 1
@WKSTA <> "VELMA" is 0


but since you OR'ed then it returns TRUE.

_________________________
Home page: http://www.kixhelp.com/hb/

Top
#112704 - 2004-01-28 08:06 PM Re: Using @PRODUCTTYPE
BloggingITGuy Offline
Fresh Scripter

Registered: 2002-12-04
Posts: 6
Hmm...OK I guess I should have stayed awake when they taught logic in school.

Thanks for the primer.

Will try some of both of your suggestions and let you know how it goes.

Thanks

Top
#112705 - 2004-05-17 04:38 PM Re: Using @PRODUCTTYPE
DTOS Offline
Lurker

Registered: 2004-05-17
Posts: 3
Is @PRODUCTTYPE supported in version 3.63 or is it only supported in 2001? Is there a way to identify a Windows XP machine using @inwin & @dos?
Top
#112706 - 2004-05-17 04:50 PM Re: Using @PRODUCTTYPE
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Please do not hijaak this thread. A quick search of the manual would tell you if it is supported in 3.63, and yes it can be done with @DOS.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

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 823 anonymous users online.
Newest Members
JimDunn, fgarcia, Viginette, ManuvdWielNL, Sir_Barrington
17890 Registered Users

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