Page 1 of 4 1234>
Topic Options
#55517 - 2001-05-02 02:37 AM Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Updated: 3:47 PM 3/4/2002

I have created a totally modular logon script, and want to share it with the board.
http://kix.isorg.net/other_scripts/AdminScripts/Kix_Logon_script.zip

The Modular Logon Script was designed using Kix2001 (and is not backwards compatible), and is performing excellent under the current beta 2a release.

One of the cool features about this logon script is that everything that it can do is controlled by a central config.ini file (anyone want to create a GUI interface for the confg.ini file??)

The Modular Logon Script is broken down into (at the moment) 8 modules.

they are

  • CTRL_C (turn break on/off)
  • legal_notice (display a legal notice with the option to force accpetiance)
  • Welcome (Display a welcome notice)
  • PWExpire (display a Password is old notice X number of days before it expirs)
  • Set_Clock (set the systemclock to match a server)
  • Drives (map drives, based on an extensive group membership rules!)
  • Path (add AND remove paths from the %path% statment, Not fully tested on win9x computers)
  • Other_scripts (run custom standalone kix scripts)

I am trying to come up with a Whitepaper on how to create a module, so that others can help out if they want...

Also there are extensive OS and Group membership rules available to customize how the logon script preforms.

here is the Logon-ReadMe.txt file

code:

--Modular logon script--

Everything that this logon script can do is controlled by the config.ini.

You can control what modules run by editing the [Module_run_order] entries.


The two major settings are "OS Type" and "Group Membership"

OS type: this can be

Win9x| All Win95, Win98 and Windows ME
NT| All NT 4.0 computers
Win2k| All Windows 2000 computers
NTx| Both NT and windows 2000 computers
ALL| All computers regardless of OS

Group membership:
There are 6 types of group memberships avaliable

l = local groups
|L!Administrators| would be only for users that have local admin
|L!\\server\group| Would check for membership in a Local group on
a remote computer

G = Global groups
|G!Domain Admins| would only execute for users in the "Domain Admins"
global group

|G!MIS\users| Will only execute if a member of the trusted domain
"MIS" and in the global Users of that domain

U = Username
|U!smithb| would only execute for user smithb

W = Workstation name
|W!testcomputer1| would only execute if ran on "testcomputer1"

I = ip#
|I!128.2.0.0/255.255.0.0| would only execute for computers in the 128.2.0.0 subnet
|I!128.2.10.11/255.255.255.255| would only execute for the ipaddress 128.2.10.11

In addition to [Module_run_order], you can also use "OS Type" and "Group membership" for
the modules [Drives] and [Other_Scripts] for added extra control.


Example:

For your Win9x users you want to map a s: to \\server1\accounting, and you want your NT users
to map their s: to \\server2\accounting


mapping1 = win9x|G!domain users|\\server1\accounting|s:
mapping2 = NT|G!domain users|\\server2\accounting|s:



This script is still in beta..... But I would really like some input on this, and if anyone can think of a module that would be a good thing to add, please let me know.

The next module I am going to write is add/remove/edit reg entries.

Many thanks to this board... with out all of yall.... I would never have been able to create this.


3-4-2002:
Fixed the security issues that NT vs Win9x issues when writting to the reg config key.

Fixed Local Group bug due to change in kix4.x

Bryce

[ 04 March 2002: Message edited by: Bryce ]

Top
#55518 - 2001-05-02 04:25 PM Re: Modular Logon Script
Anonymous
Unregistered


Hey Bryce,

I haven't tested it yet, but I can imagine that this is the answer to my prayers If it is OK with you, I would like to try to make an interface for it in ASP. That means that the .ini file has to be a database, but I think I will just make a script that extracts the data from the database and updates the .ini file. And also, is it possible to make it so modular so you select each option on a per user/group basis?

An idea for a module could be to set the wallpaper and screensaver? And what about a copy files module, that copies user specified files? Another one could be configuring Outlook? And yet another one could be checking (even though this can be done through registry in most cases) and updating anti virus software? We could make modules for each anti virus software available? What about a config setting that sets the administrator email to help notification in case of errors? Maybe a module for installing printers? And maybe just for kicks have a statistics module to make statistics on network use?

Damn, I think this is my longest post ever Anyway I hope other people read this post as well, and we all can join forces to make all these modules?

P.S.
This script will for sure change the future of login scripting, and network administration

------------------
Cheers....

David

Top
#55519 - 2001-05-02 07:11 PM Re: Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
thanks for the feedback!

I just made a small change to the config.ini, but a GUI interface would be extremely amazing!

quote:

, is it possible to make it so modular so you select each option on a per user/group basis?

yes it is. Groupcode() is usable at all levels, You can set it up so that only user ID smithb will Run a module.

Or place a more broader groupcode on the module level, and change the groupcode on the indivual action# of the module, so that only smithb will map a z:, add w:\stuff to his path, or run a custom script.

As other modules are added that have multiple Action#, this behavior will be added in them as well.

Bryce

------------------
kix.isorg.net

Top
#55520 - 2001-05-02 07:12 PM Re: Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Update: 10:34 AM 5/2/2001

Kix_Logon_script.zip


  • Changed the way that the GroupGode() field in the config.ini is used.
    Instead of *(group), it now is *!(group)
    Changed the code in functions\kix_functions.kix to handle this change

  • Cleaned up the main Logon.kix file
  • Cleaned up the Path Module (modules\path.kix)
  • Cleaned up the Drives Module (modules\drives.kix)
  • cleaned up the Other_Scripts Module (modules\other_scripts.kix)
  • Created a Module template script (modules\Module_template.kix)

Bryce

------------------
kix.isorg.net

Top
#55521 - 2001-05-03 12:07 AM Re: Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Updated: 3:52 PM 5/2/2001

Kix_Logon_script.zip

Got IP address groupcode rules working!

code:

Group membership:
There are 6 types of group memberships avaliable

l = local groups
|L!Administrators| would be only for users that have local admin
|L!\\server\group| Would check for membership in a Local group on
a remote computer

G = Global groups
|G!Domain Admins| would only execute for users in the "Domain Admins"
global group

|G!MIS\users| Will only execute if a member of the trusted domain
"MIS" and in the global Users of that domain

U = Username
|U!smithb| would only execute for user smithb

W = Workstation name
|W!testcomputer1| would only execute if ran on "testcomputer1"

I = ip#
|I!128.2.0.0/255.255.0.0| would only execute for computers in the 128.2.0.0 subnet
|I!128.2.10.11/255.255.255.255| would only execute for the ipaddress 128.2.10.11



------------------
kix.isorg.net

[This message has been edited by Bryce (edited 03 May 2001).]

[This message has been edited by Bryce (edited 03 May 2001).]

Top
#55522 - 2001-05-03 01:27 AM Re: Modular Logon Script
Anonymous
Unregistered


Bryce,

First off, you da man. I'd like to thank you for posting your code to the board. I'm new to Kixtart and find that people like you make my job (as well as learning curve) a lot easier. I however have a question for you...

Let me setup my environment...
I have 56 center, all of these centers have a t: drive that is mapped to a different dir on the same server. Each of these locations has a Global group assigned to them....
IE

Center #503 all users at that center are in-group 503-usr
Center #002 all users at that center are in-group 002-usr
Etc.
Their T drive is as follows

Center #503 T:\\server1\s00503
Center #002 T:\\server1\s00002
Etc.

Now my question...
Instead of writing 56 different actions in the config.ini file is there a way to write one action with a wild card.

IE
action1 = all|G! "center #" + USR |\\server1\sc00 + "center #" |w:

I found on the board this script

if $dialedin = "NO"
$index = 0
$psft = "no"
$group = "1"
WHILE $psft <> "yes" AND LEN("$group") <> "0"
$group = EnumGroup($index)
$ingr = INSTR("$group","psoft")
if $ingr <> "0"
$psft = "yes"
else
$psft = "no"
$index = $index + 1
endif
LOOP
endif

But due to my inexperience with Kixtart it has confused the heck out of me.

I do not know if you can place wildcards in the ini file and I think (if I have read this help file correctly) I can run a script before hand that will pass the variable off to the ini file. But still, my poor little brain just will not wrap itself around this problem. If you or anyone else on this borad can help I would be very thankfull.

[This message has been edited by FreRange (edited 03 May 2001).]

[This message has been edited by FreRange (edited 03 May 2001).]

Top
#55523 - 2001-05-03 01:31 AM Re: Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
wildcards are one of the things that I was wanting to add to the Group Membership rules... let me see what i can do

Bryce

Top
#55524 - 2001-05-03 01:39 AM Re: Modular Logon Script
Anonymous
Unregistered


*Huge dramatic sigh of relief*

Bryce,

I have about 26 centers in the Texas area and if have to go out there for any reason, I'll shoot you and email and buy you dinner.

Thanks again....

Top
#55525 - 2001-05-03 03:05 AM Re: Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Ok this is the Idea that i have kicking arround in my head for wildcard global, local, and workstation rules

action1 = all|g!????-usr|\\server\????-usr|w:
action2 = all|g!usr*|\\server\share*|w:

what will happen is this... (the hard part is the UNC, it is easy to get a wildcard for the groupmembership... filling in the missing data to the UNC.... it is doable )

Groupcode will see the wildcard symbol ? or *. Walk through the possable groups looking for the first match. And make the groupcode return a TRUE value. Groupcode will also take a look at the UNC if a wild card pattern was used, and if the same wildcard pattern can be found there, it will fill in the missing information for the UNC statment as well.

Now to just write the code.....

Bryce

------------------
kix.isorg.net

Top
#55526 - 2001-05-03 03:06 AM Re: Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
grrr double post...

[This message has been edited by Bryce (edited 03 May 2001).]

Top
#55527 - 2001-05-03 03:35 PM Re: Modular Logon Script
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
OK, i was making one with the same idea, but i can't spare much time on it
anyway, here are my suggestions :

1- Instead of having a "module = x" and module1=, module2=, ... to moduleX=, i use this :

code:

Funtion IniSearchGroup($inifile, $Inigroup)
Dim $nulF

IF Open(9, $inifile,2) = 0
do
$nulF=Ltrim(readline(9))
until lcase($nulF)="["+ lcase($Inigroup) +"]" or @ERROR <> 0
If @error=0
do
Select
case len($nulF)<1

case substr($nulF,1,1)="["

case substr($nulF,1,1)=";"

case 1
redim preserve $IniSearchGroup[ubound($IniSearchGroup)+2]
$IniSearchGroup[ubound($IniSearchGroup)]=$nulF
endselect
$nulF=ltrim(readline(9))
until substr(lcase($nulF),1,1)="[" or @ERROR <> 0
else
'Error
endif
else
'Error
endif
$temp=CLOSE(9)

Endfunction



The function will return something like this in a array :
Array[0]="test1,5"
Array[1]="test2,a"
Array[x-1]="Testx,2"
from this part of an ini file :
code:

[Group to search]
test1,5
test2,a
Testx,2
[end]


The bad part is for a big file, but ini files are generally small

2- Give the "Server" possibility and a DisableForServer parameters.

3- For your Group wildcard, maybe you can use this :
All|GroupA|\\Server\Share\$group$
The $Group will take the value GroupA with the Execute command from Kixtart. You can take $Group, @group or anything you want to distinct the variable from the text
I'm currently implementing this in my script (or must i say debugging it ?)
When the function is working, it can be use elsewhere.

4-Well, nothing more for moment. Anyway, i like your implementation of the ip range.

[This message has been edited by Popovk (edited 03 May 2001).]

_________________________
? getobject(Kixtart.org.Signature)

Top
#55528 - 2001-05-04 01:56 AM Re: Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
update 5:53 PM 5/3/2001

Kix_Logon_script.zip

Added wildcard search to the global groupcode argument, Files changed (functions\kix_functions.kix)

code:

G = Global groups
|G!Domain Admins| would only execute for users in the "Domain Admins"
global group

|G!MIS\users| Will only execute if a member of the trusted domain
"MIS" and in the global Users of that domain

|G!?user| Will search all global groups using "user" as a wild card


Also added a Custom variable section. This section will let you create custom variables and or
execute custom code. File added (functions\Custom_Variables.kix)

Bryce

[This message has been edited by Bryce (edited 04 May 2001).]

Top
#55529 - 2001-05-04 01:59 AM Re: Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
FreRange:

Ok i think i have something that you can use

first get the latest version of the logon script.

2nd add this line to the drivemapping action part of config.ini

action1 = all|G!?-usr|\\server\sc00" + $customvar1 + "|w:

then add this bit of code to the functions\custom_Variable.kix file

code:

if 1=1
DIM $pointer, group
do
$group = enumgroup($pointer)
$pointer = $pointer + 1
until instr($group,"-USR") <> 0 OR len($group) = 0
$customvar1 = substr($group,instr($group,"\")+1,instr($group,"-USR")-instr($group,"\")-1)
endif

let me know if it works!

Bryce

------------------
kix.isorg.net

Top
#55530 - 2001-05-04 07:42 PM Re: Modular Logon Script
Anonymous
Unregistered


Exclent scripting by one of the masters.

Has anyone have this in production????

Top
#55531 - 2001-05-04 09:55 PM Re: Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Not ready for production yet....

I am still hammering out the framework and adding/cleaning up some of the features. For example, i just cleaned up the process that lets you use variables and kix macros in the actual config.ini file. using variables and macros are no longer restricted to just the UNC part of the drive mapping actions.

For example the \\server\@userid$$ bit that a lot of us use. You can represent this like the following in config.ini \\server\~@userid~$

I also need to finish the wildcard search for the Local Group and Computer Name rules.

I would like to create a few more Modules for it as well.

Since this is Kix2001 code only, Putting a beta product into production is not a good thing

I have ran this logon script on NT, Win95(a small handful), and win2k computers and things ran great.

Bryce

------------------
kix.isorg.net

Top
#55532 - 2001-05-04 10:06 PM Re: Modular Logon Script
Anonymous
Unregistered


First off, I want to say, great script. It's given me a lot of good ideas. I have two questions:

1) I haven't had a chance to go over every little detail of the scripts, but what pieces do you know of off hand require kix 2001, and would it be easy to completely revamp this thing to run w/ v3.62 or 3.63?

2) I want to add another piece to check domain, as well as user group and OS. All I'd need to do is up the array used in the split command and alter it there to check for this. Is that correct? And relating to question one, the split command doesn't exist in the previous versions, but it wouldn't be too hard to parse the string using instr(), correct?

Sometimes I'm just completely in awe of the things you come up with, Bryce. Great stuff.

Top
#55533 - 2001-05-04 11:01 PM Re: Modular Logon Script
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
Taking it back to 3.63 would be quite a challenge!

You see, I have fallen in love with the function command, and have created several custom functions (functions\kix_functions.kix), that get called at all levels of the script These custom functions have allowed me to be really creative with some of the features of the script.

Not to mention the heavy use of the split() command, Ubound() command FOR NEXT loop's, and FOR EACH NEXT loop's.

Ruud! is the man!!!! He has created a truly powerful scripting language!

Bryce

------------------
kix.isorg.net

Top
#55534 - 2001-05-04 11:13 PM Re: Modular Logon Script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Bryce, I agree with you 110% !!!

Using k over the past few weeks has been such a joy. KiXtart is so much more natural and flowing now. How we got along (for so long) without UDF's is beyond me. Ruud has done an amazing incredible job.

Thank you Ruud !!!!!

Shawn.

Top
#55535 - 2001-05-04 11:51 PM Re: Modular Logon Script
Anonymous
Unregistered


Too late, I've already got it

I've got it almost completely back to 3.62, with a LibraryCall called script, for Split and Ubound, that do the same thing as the functions do. I changed all the For.. Next Loops to While loops with counters. So far so good.

Top
#55536 - 2001-05-05 01:48 AM Re: Modular Logon Script
Anonymous
Unregistered


As Bryce's has started a discussion which is open ended I can see it going on for a long time. As such it would perhaps be worthwhile having a whole separate message area for discussing modular scripts. That way ideas could branch off into separate threads and will be easier to follow as the concept grows and ideas keep flowing.
Top
Page 1 of 4 1234>


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 2145 anonymous users online.
Newest Members
BeeEm, min_seow, Audio, Hoschi, Comet
17882 Registered Users

Generated in 0.373 seconds in which 0.013 seconds were spent on a total of 12 queries. Zlib compression enabled.

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