#160528 - 2006-04-07 06:06 PM
Bypassing script on server OS
|
DrUltima
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
|
|
|
|
#160531 - 2006-04-07 06:56 PM
Re: Bypassing script on server OS
|
DrUltima
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
   
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
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
   
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
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 1334 anonymous users online.
|
|
|