Page 1 of 1 1
Topic Options
#195078 - 2009-07-28 04:10 PM Map drives and printer by group memberships not working correctly
cmax Offline
Fresh Scripter

Registered: 2009-07-28
Posts: 7
Loc: London
Greetings
I'm new to scripts and don't understand why the example below maps different items depending on its location in the script.

 Code:
Use s: /delete /persistent
Use p: /delete /persistent
Use o: /delete /persistent

If InGroup("all staff") >0
	Use s: "\\myserver\staffarea"
	ADDPRINTERCONNECTION ("\\myserver\staffprinter") 
Endif

If InGroup("all pupils") >0
	Use p: "\\myserver\pupilarea"
	ADDPRINTERCONNECTION ("\\myserver\pupilprinter") 
Endif

If InGroup("office") >0
	Use o: "\\myserver\officearea"
	ADDPRINTERCONNECTION ("\\myserver\officeprinter") 
Endif


If a user belongs to both "all staff" & "office" group they don't get both sets of mappings.
Is this easy to correct?

Is there a way that when logging onto the pc I can process/check all the commands/errors that the script runs?

Many thanks

Craig


Edited by Mart (2009-07-28 07:52 PM)
Edit Reason: Added code tags.

Top
#195082 - 2009-07-28 05:30 PM Re: Map drives and printer by group memberships not working correctly [Re: cmax]
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
You can run the script in debug mode

 Code:
kix32 <script> /d


this will let you run things 1 line at a time and see what is going on.


Edited by Richard H. (2009-07-29 03:22 PM)
Edit Reason: Used CODE tags to prevent HTML problems.

Top
#195086 - 2009-07-28 07:58 PM Re: Map drives and printer by group memberships not working correctly [Re: cmax]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Bryce,

Did you post some funky stuff? My entire screen is messed up and the Reply, Quote, etc... options are gone.

CMAX,

Please use the code tags when posting code. I added them for you this time.

Some tips for your script:
- The >0 after each Ingroup is not needed.
- To be sure mapping the drive works you could delete it before creating it.
- You could put in some debug lines that show stuff on the screen. Like "User is in All Pupils group", "User is in Office group", etc...
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#195100 - 2009-07-29 02:49 PM Re: Map drives and printer by group memberships not working correctly [Re: cmax]
cmax Offline
Fresh Scripter

Registered: 2009-07-28
Posts: 7
Loc: London
Thanks for the quick reply.
Debug "on" is proving to be a big help.
Cheers

Top
#195162 - 2009-07-31 12:05 AM Re: Map drives and printer by group memberships not working correctly [Re: Mart]
cmax Offline
Fresh Scripter

Registered: 2009-07-28
Posts: 7
Loc: London
Thank you for the replies.

Strange, when I posted my reply to the 1st response there were no other posts yet.

My 1st script is coming along quite well thanks. I'm using the manual and website to help simplify my script. Would you be able to point me in the right direction for the any of the following:

(ver 4.53)
1) Can Enumgroup be used to simply display all the groups a user is a member of in Win2003 XP enviroment?

2) Can I use diferent arrays to group printer mappings in then use the array to map those printers to user with IF InGroup?
eg - $PupilMapping="\\server\printer1","\\server\printer2"
then - If InGroup("pupils") map all printers in $PupilMapping

Thank you for your support.

Top
#195163 - 2009-07-31 04:54 AM Re: Map drives and printer by group memberships not working correctly [Re: cmax]
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
for #2, take a look at the "for each" command
Top
#195166 - 2009-07-31 08:56 AM Re: Map drives and printer by group memberships not working correctly [Re: cmax]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
 Originally Posted By: cmax

Strange, when I posted my reply to the 1st response there were no other posts yet.
....


That was because Bryce posted something that was interpreted as HTML by the board and that accidently messed up the thread. All is fixed by Richard H now.

 Originally Posted By: cmax

....
1) Can Enumgroup be used to simply display all the groups a user is a member of in Win2003 XP enviroment?
....

Yes.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#195179 - 2009-07-31 12:37 PM Re: Map drives and printer by group memberships not working correctly [Re: Mart]
cmax Offline
Fresh Scripter

Registered: 2009-07-28
Posts: 7
Loc: London
Enumgroup working well - thank you

 Code:
 

$PupilMappings = "\\server\share1","\\server\share2"

For Each $Element in $PupilMappings
	Use o: $Element
	Use z: $Element



Is this the best method for grouping map drives to use in script when user is a member of group map all drive in the array?

Cheers

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
0 registered and 515 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.058 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org