#192188 - 2009-02-12 04:22 PM
Odd issue with nested IF statements.
|
danf
Fresh Scripter
Registered: 2009-02-09
Posts: 9
Loc: West Virginia, USA
|
Below is a section of code that I am trying to implement. The first section under the the first IF sets a list of default drive shares. This is followed by a series of IF statements that will assign drives based on if a person is in that group. I changed the script to remove internal naming but that was it.
;/*For MyWork Office */
IF InGroup ("Wor MyWorkOffice Staff")
;/For General Users
SETTIME "\\server-fs"
USE P: "\\server-fs\@userid$"
USE Q: "\\server-fs\common"
USE X: "\\192.168.X.XX\database"
USE Y: "\\192.168.X.XX\export"
USE H: "\\192.168.X.X\fax-scan"
;/Mappings Based on Group Memberships
IF InGroup ("Wor-MyWorkOffice-Loans")
USE I: "\\server-fs\common\01-Loans"
ENDIf
IF InGroup ("Wor-MyWorkOffice-Tellers")
USE J: "\\server-fs\common\02-Tellers"
ENDIf
IF InGroup ("Wor-MyWorkOffice-NewAcct")
USE K: "\\server-fs\common\03-New Accounts"
ENDIf
IF InGroup ("Wor-MyWorkOffice-Collect")
USE L: "\\server-fs\common\04-Collections"
ENDIf
IF InGroup ("Wor-MyWorkOffice-Book")
USE M: "\\server-fs\common\05-Bookkeeping"
ENDIf
IF InGroup ("Wor-MyWorkOffice-ExecMgmt")
USE N: "\\server-fs\common\06-Exec Mgmt"
ENDIf
IF InGroup ("Wor-MyWorkOffice-Operations")
USE O: "\\server-fs\common\07-Operations"
ENDIf
ENDIf
Whenever I run this using the script editor it lists each of the if statement checks but does not perform the use below it or even the endif. Can any of you guys see what I've missed?
Thanks.
-Dan
Edited by Allen (2009-02-12 04:25 PM) Edit Reason: added code tags
|
|
Top
|
|
|
|
#192194 - 2009-02-12 05:00 PM
Re: Odd issue with nested IF statements.
[Re: Richard H.]
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
Here is a version with some error checking:
;/*For MyWork Office */
IF InGroup ("Wor MyWorkOffice Staff")
;/For General Users
SETTIME "\\server-fs"
USE P: "\\server-fs\@userid$"
USE Q: "\\server-fs\common"
USE X: "\\192.168.X.XX\database"
USE Y: "\\192.168.X.XX\export"
USE H: "\\192.168.X.X\fax-scan"
;/Mappings Based on Group Memberships
MyUse("Wor-MyWorkOffice-Loans","I:","\\server-fs\common\01-Loans")
MyUse("Wor-MyWorkOffice-Tellers","J:","\\server-fs\common\02-Tellers")
MyUse("Wor-MyWorkOffice-NewAcct","K:","\\server-fs\common\03-New Accounts")
MyUse("Wor-MyWorkOffice-Collect","L:","\\server-fs\common\04-Collections")
MyUse("Wor-MyWorkOffice-Book","M:","\\server-fs\common\05-Bookkeeping")
MyUse("Wor-MyWorkOffice-ExecMgmt","N:","\\server-fs\common\06-Exec Mgmt")
MyUse("Wor-MyWorkOffice-Operations","O:","\\server-fs\common\07-Operations")
ENDIf
Function MyUse($sGroup,$sLetter,$sPath)
If InGroup($sGroup)
"I am in group '"+$sGroup+"' so will try to map '"+$sPath+" as drive "+$sDrive+@CRLF
Use $sLetter $sPath
If @ERROR "ERROR mapping drive: ["+@ERROR+"] "+@SERROR+@CRLF
Else
"I am not in group '"+$sGroup+@CRLF
EndIf
EndFunction
|
|
Top
|
|
|
|
#192198 - 2009-02-12 05:28 PM
Re: Odd issue with nested IF statements.
[Re: Richard H.]
|
danf
Fresh Scripter
Registered: 2009-02-09
Posts: 9
Loc: West Virginia, USA
|
I'm using the new and most current version of Kix.
|
|
Top
|
|
|
|
#192199 - 2009-02-12 06:13 PM
Re: Odd issue with nested IF statements.
[Re: danf]
|
danf
Fresh Scripter
Registered: 2009-02-09
Posts: 9
Loc: West Virginia, USA
|
I think I may have figured it out. I had a nested group within the "Wor-MyWorkOffice-Loans" group that contained the test user account. Once I created a separate if statement for the group that had been nested, things worked great.
Now my next problem seems to be dealing with this setdefaultprinter section. I have it setup as follows:
IF InGroup ("Branch-UpperPrint") SetDefaultPrinter("\\server-fs\branchupstairs") ENDIf IF InGroup ("Branch-LowerPrint") SetDefaultPrinter("\\server-fs\branchdownstrs") etc...
It always sets the default printer to be the upperprint one no matter what.
Any thoughts on this? Thanks a ton for the help.
-Dan
|
|
Top
|
|
|
|
#192246 - 2009-02-13 03:57 PM
Re: Odd issue with nested IF statements.
[Re: Lonkero]
|
danf
Fresh Scripter
Registered: 2009-02-09
Posts: 9
Loc: West Virginia, USA
|
Yeah Added the printer prior to the set default printer. As it turns out I think I figured it out. Apparently I had figured in my code staring induced stuper that if I have a nested group nested within another that I could call the master group and Kix would still apply the membership of all the members of the nested group. Once I manually added each of the people to the main group it worked without a hitch. Thanks a ton guys. I was sitting here wringing my fist at my script and here it was my AD that was causing the problem.
-Dan
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1270 anonymous users online.
|
|
|