Page 1 of 1 1
Topic Options
#160528 - 2006-04-07 06:06 PM Bypassing script on server OS
DrUltima Offline
Fresh Scripter

Registered: 2002-08-16
Posts: 21
Loc: Nashville, TN, USA
I did a search for this and didn't find anything that addressed this issue, but as I am new, I could have missed it. If so, sorry. I want to make sure the script bombs out after a certain point if the user is logging into a server. Here is how I thought this should be done:
Code:
Dim $UID, $PT
$UID = @UserID
IF @ProductType = "Windows 2000 Server"
OR "Windows 2000 Domain Controller"
OR "Windows Server 2003"
OR "Windows Server 2003 Domain Controller"
OR "Windows Server 2003 R2"
OR "Windows Server 2003 R2 Domain Controller"
$PT = "Server"
ELSE
$PT = @ProductType
ENDIF

;and later

IF $PT = "Server"
? "Bypassing the login script because you are logging in"
? "from a " + @ProductType + "!"
GOTO end ;bypassing the rest of this script
ENDIF


The problem is that it is giving that message even on a Windows XP Pro computer and then bombing to end. I also tried it without the quotation marks around 'server'. What am I doing wrong?

Thanks!


Edited by Howard Bullock (2006-04-07 08:31 PM)

Top
#160529 - 2006-04-07 06:31 PM Re: Bypassing script on server OS
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
The OR structure is all wrong. Each OR condition has to be able to stand on its own.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#160530 - 2006-04-07 06:52 PM Re: Bypassing script on server OS
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Do you have enough info to go on?
Are you interested in knowing where you went wrong or simply want a working solution?

A better approach would be to use InStr() to search @ProductType for "Server" or "Domain Controller".
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#160531 - 2006-04-07 06:56 PM Re: Bypassing script on server OS
DrUltima Offline
Fresh Scripter

Registered: 2002-08-16
Posts: 21
Loc: Nashville, TN, USA
That fixed it. Now I really do feel dumb... Thanks for your help!
Top
#160532 - 2006-04-07 07:34 PM Re: Bypassing script on server OS
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
This method will bypass EVERY server type.

Code:

Dim $SRVR
$SRVR = ReadValue('HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions','ProductType')
If $SRVR<>'WinNT'
;Use the Exit to bypass functions or Quit to end the entire script.
Exit 10
EndIF


 

Top
#160533 - 2006-04-07 08:57 PM Re: Bypassing script on server OS
DrUltima Offline
Fresh Scripter

Registered: 2002-08-16
Posts: 21
Loc: Nashville, TN, USA
After review, I looked at the INSTR function mentioned. I ended up with this:
Code:
SELECT
CASE INSTR(@ProductType,"Server")
$PT = "Server"
CASE INSTR(@ProductType,"Controller")
$PT = "Server"
CASE 1
$PT = @ProductType
ENDSELECT


I know this will not handle non-PDC/BDC NT 4 Servers, but we do not have any in place, so that wouldn't matter as much. This does seem better, and I am always wanting to learn better ways to do things. I am not a programmer, nor do I try to pretend to be. That is why I ask for help. Most of you guys are much better at this than I will probably ever become.

Top
#160534 - 2006-04-07 09:03 PM Re: Bypassing script on server OS
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Right out of my logon script


; *********** Prevent script from running on a server ***************
If not instr(@producttype,'Workstation') and not instr(@producttype,'Professional') Quit endif
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#160535 - 2006-04-08 05:43 PM Re: Bypassing script on server OS
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I was just thinking...
When using Windows Terminal Server, or Citrix Metaframe, maybe you do not always want to quit the logon script when running on a server...

Top
#160536 - 2006-04-08 05:48 PM Re: Bypassing script on server OS
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
DOH!
Why did I not think of that?

Oh wait... I did.
http://www.kixtart.org/ubbthreads/showflat.php?Cat=0&Number=81649&an=0&page=0#81649
_________________________
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:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 1334 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.031 seconds in which 0.013 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