colweb
(Fresh Scripter)
2003-10-14 01:46 PM
Huge kixtart script

Im not new to Kixtart, been using it for about 5 years, but we've never used it for much more than mapping drives so I've posted in the noobs section.

We have 3000+ groups in our domain, a lot of which are for mapping drives. This means we have a central kixtart script with about 500 USE commands in it. As you can imagine with no real naming standard in place for groups its hard to find what drives are mapping for which users (without going through the long process of checking each group for each user singlely)

I was wondering if it was possible to write a kixtart script that could "run" the logon script for a given user (without replicating the logon process) and return a list of what drive letters were supposed to be mapped for that user.

Does anyone think this is possible? I think it is but dont have the programming genius brain to make it happen, help!

Thanks in advance. [Big Grin]


Radimus
(KiX Supporter)
2003-10-14 01:53 PM
Re: Huge kixtart script

so you want to audit the logon process for users and generate a list of mapped drives.

But you want to do it as an admin tool, and then RUNAS each user...

You would need their username and password.
run the script
use DriveEnum() and DriveProp() UDFs to collect the mapped drives
dump it to a file
exit and run it again for a new user


LonkeroAdministrator
(KiX Master Guru)
2003-10-14 01:56 PM
Re: Huge kixtart script

hmm...
there is 2 ways to do this.
for a real dynamic script (groupmaps according to dynamic groupnames) it's easy but think in your case there is little harder way needed.

you would need to read in your logonscript and split all your use statements to an array.
then check each of those against some users groups.


colweb
(Fresh Scripter)
2003-10-14 01:58 PM
Re: Huge kixtart script

Thanks for the speedy response.

I would like to Audit the logon drives for users, but without having to logon as them (requiring passwords etc). I simply want to be able to feed a script a User's ID and for it to tell me what drives they will get mapped....

I will have a read about those UDFs though.

Cheers,

Col.


colweb
(Fresh Scripter)
2003-10-14 02:00 PM
Re: Huge kixtart script

up until now Ive been "processing" the logon script manually with Excel and collating into MS Access. Then importing the Users and Groups using Hyena, then linking it all together. Works nice until someone makes changes on the live system then you've got to start again... doooooh...

LonkeroAdministrator
(KiX Master Guru)
2003-10-14 02:15 PM
Re: Huge kixtart script

that's why you should modify the live-system.
make it ini or similar based.
every group that has a mapping, has a ini-section associated to it.
this way each user can map all the drives with SHORT code and you can enum all the groups with SHORT code.


colweb
(Fresh Scripter)
2003-10-14 03:21 PM
Re: Huge kixtart script

hmmmm a bit of work there for 500 groups though.... doh!

Ah well, I'll do my MS Access "solution" again and sort these users out....

I've also emailed a DOS guru who might find another way using various "FIND" commands etc..

Thanks everyone for their comments. [Big Grin]


Howard Bullock
(KiX Supporter)
2003-10-14 03:29 PM
Re: Huge kixtart script

You may also have other avenues available to you as well.

After reading this thread I am left wondering how you actually use these groups to map drives. Could you provide some code? Are you using a Master domain model where users are in an account domain and computers are in resource domains? Have you though about logically calling sub-scripts with specific functionality for different groups or classes of users?

See for some additional ideas: http://home.comcast.net/~habullock/logon_script_architecture.htm

Also see my GrpMaint.exe program elsewhere on my site which can enumerate all users in all groups and write the output to a text file. Great for importing into excel or Access.

[ 14. October 2003, 15:33: Message edited by: Howard Bullock ]


Bryce
(KiX Supporter)
2003-10-14 04:05 PM
Re: Huge kixtart script

A few ideas…

First, Get a list of a given users groups memberships by using the UDF UserGroups

Now, you are going to want to compare this list against your current logon script's ingroup/USE commands. With out knowing how your code is written i am only able to give you some pointers on how to do this. Either way, it will require you reading in your logon script as a text file and parsing the data that you are looking for.

And easier way would to use the suggested external INI file method. But even this will require you to rewrite your logon script to support such an action. Might be more work at the beginning, but will really pay off in the end.

This might be of some help... a shell command to get out only the "USE" lines. like USE d: \\server\share

shell '%comspec% /c findstr /i "USE " logon.kix | find /i ":" > temp.txt'

Just read in temp.txt for a list of what share = what drive letter in your script.

Bryce


Sealeopard
(KiX Master)
2003-10-14 04:11 PM
Re: Huge kixtart script

quote:
As you can imagine with no real naming standard in place for groups its hard to find what drives are mapping for which users
This would need to be taken care of immediately. Secondly, one could parse the original login script and extract the mappings that are defined for each user/group, maybe even based on the userid. However, whitout seeing the original script and hwo the drives are being mapped for each user, it's hard to suggest specifics. Thirdly, one could also remotely scan the registry for the user's mapped drives under HKCU\Network.


Howard Bullock
(KiX Supporter)
2003-10-14 04:30 PM
Re: Huge kixtart script

If you just want a list of what drives are mapped, you could also add some code to the logon script to enumerate the mapped drives and write the data as a file to a network share. ?You could then collect this data and use it accordingly.