#119490 - 2004-05-13 02:19 PM
SELECT CASE and INGROUP stopped working!
|
jwalker
Fresh Scripter
Registered: 2004-05-13
Posts: 6
|
Last week I know this code was working. Now, it seems to have stopped. If I run it in debug mode, it displays the SELECT line, but I don't see it run anything after that. It is reading the user's group memberships because I can see them in the user's registry hive. But, it does not seem to be doing anything with this information. Please help! I have users calling left and right because this functionality is broken.
Code:
$BRIO = ReadValue ("HKEY_CURRENT_USER\SOFTWARE\BRIO SOFTWARE\BRIOQRY\BRIOQRY", "MODENUMBER")
SELECT CASE InGroup("CX_Brio Designer") IF $BRIO <> "XXX-XXX" WriteValue ("HKEY_CURRENT_USER\SOFTWARE\BRIO SOFTWARE\BRIOQRY\BRIOQRY","MODENUMBER", "XXX-XXX","REG_SZ") IF @ERROR = 0 ? "The update of your registry was successful" ELSE ? " The system could not write the registry value" ENDIF ENDIF CASE InGroup("COR_CX_Brio Designer") IF $BRIO <> "XXX-XXX" WriteValue ("HKEY_CURRENT_USER\SOFTWARE\BRIO SOFTWARE\BRIOQRY\BRIOQRY","MODENUMBER", "XXX-XXX","REG_SZ") IF @ERROR = 0 ? "The update of your registry was successful" ELSE ? " The system could not write the registry value" ENDIF ENDIF CASE InGroup("CX_Brio Explorer") IF $BRIO <> "XXX-XXX" WriteValue ("HKEY_CURRENT_USER\SOFTWARE\BRIO SOFTWARE\BRIOQRY\BRIOQRY","MODENUMBER", "2L55-8282T","REG_SZ") IF @ERROR = 0 ? "The update of your registry was successful" ELSE ? " The system could not write the registry value" ENDIF ENDIF CASE InGroup("COR_CX_Brio Explorer") IF $BRIO <> "XXX-XXX" WriteValue ("HKEY_CURRENT_USER\SOFTWARE\BRIO SOFTWARE\BRIOQRY\BRIOQRY","MODENUMBER", "XXX-XXX","REG_SZ") IF @ERROR = 0 ? "The update of your registry was successful" ELSE ? " The system could not write the registry value" ENDIF ENDIF ENDSELECT
|
|
Top
|
|
|
|
#119491 - 2004-05-13 02:25 PM
Re: SELECT CASE and INGROUP stopped working!
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
You can simplify your code quite a bit..
NOTE: The addition of @ERROR and @SERROR
Code:
$REG="HKCU\SOFTWARE\BRIO SOFTWARE\BRIOQRY\BRIOQRY"
$BRIO=ReadValue($REG,"MODENUMBER")
IF InGroup("CX_Brio Designer","COR_CX_Brio Designer","CX_Brio Explorer","COR_CX_Brio Explorer")
IF $BRIO <> "XXX-XXX"
$RC=WriteValue ($REG,"MODENUMBER", "XXX-XXX","REG_SZ")
IF @ERROR = 0
? "The update of your registry was successful"
ELSE
? " The system could not write the registry value"
@ERROR+" "+@SERROR
SLEEP 3
ENDIF
ENDIF
ENDIF
HTH,
Kent
|
|
Top
|
|
|
|
#119492 - 2004-05-13 02:30 PM
Re: SELECT CASE and INGROUP stopped working!
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Things you may need..
Flush your token cache for group detection..
In your INGROUP checking, you may need to precede the group with a domain name - Code:
IF InGroup("DOMAINA\CX_Brio Designer","DOMAINB\COR_CX_Brio Designer","DOMAINB\CX_Brio Explorer","DOMAINB\COR_CX_Brio Explorer") ; ... other code....
|
|
Top
|
|
|
|
#119493 - 2004-05-13 03:31 PM
Re: SELECT CASE and INGROUP stopped working!
|
jwalker
Fresh Scripter
Registered: 2004-05-13
Posts: 6
|
Thank you for the response. Actually, I cannot combine those. It uses different mode numbers depending upon a user's group membership. I just blanked them out with XXX-XXX.
|
|
Top
|
|
|
|
#119494 - 2004-05-13 03:33 PM
Re: SELECT CASE and INGROUP stopped working!
|
jwalker
Fresh Scripter
Registered: 2004-05-13
Posts: 6
|
I did try preceding the groups with domain names, but still no luck. It's not entering the registry key/value.
|
|
Top
|
|
|
|
#119496 - 2004-05-13 04:25 PM
Re: SELECT CASE and INGROUP stopped working!
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Did you try to add in the @ERROR+' '@SERROR code?
That will tell you why this does not WRITEVALUE.
Kent
|
|
Top
|
|
|
|
#119498 - 2004-05-13 07:46 PM
Re: SELECT CASE and INGROUP stopped working!
|
jwalker
Fresh Scripter
Registered: 2004-05-13
Posts: 6
|
Kixstrip doesn't show any errors.
The @ERROR+' '@SERROR code doesn't show anything.
The case 1 entry appears to be showing that the userid isn't a member of any of the groups mentioned. But, the userid is a member of one of the groups. If I look in the token cache, that group is listed.
|
|
Top
|
|
|
|
#119499 - 2004-05-13 08:31 PM
Re: SELECT CASE and INGROUP stopped working!
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Are you sure this is the right Reg Key to modify?
HKEY_CURRENT_USER\SOFTWARE\BRIO SOFTWARE\BRIOQRY\BRIOQRY
Maybe try using the RegSnap tool from the Registry Tools FAQ here? Then apply the changes using the before and after snapshots to see what is really going on.
Kent
|
|
Top
|
|
|
|
#119502 - 2004-05-14 07:25 PM
Re: SELECT CASE and INGROUP stopped working!
|
jwalker
Fresh Scripter
Registered: 2004-05-13
Posts: 6
|
The script appears to be working again. Although, I'm not certain why it's working. I changed the group names to all lower case (even though it worked before and the case I was using matched the domain groups).
|
|
Top
|
|
|
|
#119503 - 2004-05-14 07:45 PM
Re: SELECT CASE and INGROUP stopped working!
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Did you change the version of KiXtart you were using when the problem started? If so, what versions were involved.
|
|
Top
|
|
|
|
#119504 - 2004-05-14 08:37 PM
Re: SELECT CASE and INGROUP stopped working!
|
jwalker
Fresh Scripter
Registered: 2004-05-13
Posts: 6
|
I didn't change the version of kixtart at all. Version 412 is installed. I should probably think about changing to 422, but I haven't done so yet.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|