Page 1 of 1 1
Topic Options
#122497 - 2004-07-09 06:45 PM Basic / Bone head logon script
Dellirious Offline
Fresh Scripter

Registered: 2004-07-05
Posts: 5
Loc: NW Ohio
When I came here as a new user I was overwhelmed at the extreme complexity of so many of the logon scripts. I just wanted to map a drive and add printers. So here is my boneheaded attempt. Critiques very welcome.

;**** Created with KiXscripts Editor | http://www.adminscripteditor.com/ ****
;**** Last Modified on 7/9/2004 at 12:22:31 PM by ericadmin ****
;**************************************************************************************************
;created by Eric Leszkowicz, you may remove my name and use any of the
;information contained here for your benefit

;MY DOCUMENTS MAPPED TO USER FOLDER USING GPO

;IF THIS IS THE SERVER THEN QUIT

If @WKSTA = "ENTER YOUR SERVER NAME HERE WITHOUT THE \\"
Quit
EndIf


;--Set Workstation Time

SetTime "\\ENTER YOUR SERVER NAME HERE"

;**************************************************************************************************
;This draws a box and allows the user to see all kinds of info
;This may help in diagnosing problems, otherwise the info does not
;have much use.


Box (6,20,17,70,FULL) ; ''the box''

Color w/n
At ( 7,25) "Welcome to ENTER YOUR DOMAIN NAME HERE"
At ( 9,25) "Full name : " ; display some text strings
At (10,25) "Userid : "
At (11,25) "Workstation : "
At (12,25) "Domain : "
At (13,25) "Logon Server : "
At (14,25) "Current Time : "
At (15,25) "Current Date : "

Color w+/n
At ( 9,43) @fullname ; ...and some macro''s
At (10,43) @userid
At (11,43) @wksta
At (12,43) @domain
At (13,43) @lserver
At (14,43) @time
At (15,43) @date

Sleep 4

;**************************************************************************************************
;This sets the M: drive accoording to the group that a user belongs to
;Currently there is no difference, but they are provided as they are in order
;to allow for future changes.

;IN THE BELOW EXAMPLE, YOU SHOULD REPLACE YOURGROUPNAME WITH A GROUP
;IN YOUR DOMAIN. I USE THE /DELETE JUST AS A MEASURE OF INSURANCE

If InGroup ("YOURGROUPNAME")
? "IN GROUP: YOURGROUPNAME"
Use M: /DELETE
Use M: "\\YOUR SERVER NAME\YOUR SHARED FOLDER NAME"
EndIf

If InGroup ("YOURGROUPNAME2")
? "IN GROUP: YOURGROUPNAME2"
Use M: /DELETE
Use M: "\\YOUR SERVER NAME\YOUR SHARED FOLDER NAME"
EndIf

If InGroup ("YOURGROUPNAME2")
? "IN GROUP: YOURGROUPNAME2"
Use M: /DELETE
Use M: "\\YOUR SERVER NAME\YOUR SHARED FOLDER NAME"
EndIf
;**************************************************************************************************

;This first deletes all printer connection and then adds the printer drives according the
;persons work functionality AND location
;LIST ALL printers under the DelPrinterConnection to prevent users from adding printers

;NOTE THAT I DELETE ALL PRINTERS BEFORE I ADD THEM. THIS IS BECAUSE I HAVE USERS THAT
;ARE PRONE TO ADD PRINTERS. IT DOES SLOW DOWN THE LOGIN TIMES.

DelPrinterConnection ("\\YOUR SERVER NAME\YOUR PRINTER NAME")
DelPrinterConnection ("\\YOUR SERVER NAME\YOUR PRINTER2 NAME")

If InGroup ("YOUR GROUP NAME")
AddPrinterConnection ("\\YOUR SERVER NAME\YOUR PRINTER NAME")
AddPrinterConnection ("\\YOUR SERVER NAME\YOUR PRINTER2 NAME")
SetDefaultPrinter ("\\YOUR SERVER NAME\THE NAME OF YOUR PRINTER")
EndIf


;**************************************************************************************************


Edited by Dellirious (2004-07-09 07:25 PM)
_________________________
Love what you do and you will never work a day in your life.

Top
#122498 - 2004-07-09 07:05 PM Re: Basic / Bone head logon script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Looks good to me. One thing - you should "silence" your function calls, so that funky 0's (zeros) dont get displayed to your nicely formatted login window, have you noticed them ? Silence them (all) like this:

$rs = DelPrinterConnection ("\\YOUR SERVER NAME\YOUR PRINTER NAME")

Top
#122499 - 2004-07-09 07:10 PM Re: Basic / Bone head logon script
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Is this the same place?

http://www.cbcfindlay.org/

The KiXscripts editor is now located here and has a name change:
http://www.adminscripteditor.com/

I have some code to show a pretty logon with Greeting based on time of day if you like I can look it up and post.

Top
#122500 - 2004-07-09 07:14 PM Re: Basic / Bone head logon script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Just an aside, is setting the wkstn time in the login script still an advisable thingy (to do) - even on NT, user's needed settime priv to do this, and under XP/AD not required (afaik) and can even mess things up (iirc). Anybody ?
Top
#122501 - 2004-07-09 07:24 PM Re: Basic / Bone head logon script
Dellirious Offline
Fresh Scripter

Registered: 2004-07-05
Posts: 5
Loc: NW Ohio
Quote:

Is this the same place?

http://www.cbcfindlay.org/

The KiXscripts editor is now located here and has a name change:
http://www.adminscripteditor.com/

I have some code to show a pretty logon with Greeting based on time of day if you like I can look it up and post.




Yes that is the same cbcfindlay. Yes post the code here. That would be great.

Change: removed cbcfindlay and corrected the kixscripts address.
_________________________
Love what you do and you will never work a day in your life.

Top
#122502 - 2004-07-09 07:26 PM Re: Basic / Bone head logon script
Dellirious Offline
Fresh Scripter

Registered: 2004-07-05
Posts: 5
Loc: NW Ohio
Quote:

Just an aside, is setting the wkstn time in the login script still an advisable thingy (to do) - even on NT, user's needed settime priv to do this, and under XP/AD not required (afaik) and can even mess things up (iirc). Anybody ?




I had wondered about that myself. I have 98 and NT systems running for the "time" being. No errors yet here, but wonder what the potential problems could be?
_________________________
Love what you do and you will never work a day in your life.

Top
#122503 - 2004-07-09 07:32 PM Re: Basic / Bone head logon script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
re: setting the time - Win9x is one thing, NT another and tbh we still set the system time on the user's behalf under NT. But under XP and in AD - remember reading that MS suggests you NOT set the time in fact, depending, it can cause authentication issues under AD - just wondered thats all.


Top
#122504 - 2004-07-09 07:38 PM Re: Basic / Bone head logon script
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
One more thing - I always thought AddPrinterConnection didn't/doesn't work under Win9x, are your 9x users immune to this by virtue of group membership, or maybe you should build in some more IF checking around the OS ?

-Shawn

Top
#122505 - 2004-07-09 11:53 PM Re: Basic / Bone head logon script
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
No I was not saying to modify the TIME, but simply a display a GREETING different depending on the time of day for the logon.

I'll look it up later on at home tonight and post if I find it. I've not used it now for over a year as all my logon scripting is not completely silent - NO 9x boxes anymore.

Top
#122506 - 2004-07-10 01:23 AM Re: Basic / Bone head logon script
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Okay, here is the code example I was talking about if you going to show the user the logon script actions.

Note: This requires KiXtart 4.x prefferably v4.22 or newer.


Code:
CLS
SMALL
Color b+/n
BOX (0,0,24,79,GRID) ; background grid
Color b/n
BOX (2,3,13,77,Å) ; shadow of the box
Color g+/n
BOX (1,2,12,76,FULL) ; Green box
Color b+/n
Select
Case ((@TIME > "00:00:00") And (@TIME < "12:00:00"))
AT(9,5) "Good Morning @fullname"
AT(10,5) "You are entering the @domain domain."
Color r+/n
AT(11,5)"Please wait - Network authentication is being verified . . ."
Color b+/n
Case ((@TIME > "12:00:00") AND (@TIME < "18:00:00"))
Color b+/n
AT(9,5) "Good Afternoon @fullname"
AT(10,5) "You are entering the @domain domain."
Color r+/n
AT(11,5)"Please wait - Network authentication is being verified . . ."
Color b+/n
Case 1
AT(9,5) "Good Evening @fullname"
AT(10,5) "You are entering the @domain domain."
Color r+/n
AT(11,5)"Please wait - Network authentication is being verified . . ."
Color b+/n
EndSelect
Color w+/n
AT (2,5) "Userid : " ; label for user and network identification text strings
AT (3,5) "Full Name : "
AT (4,5) "Workstation : "
AT (5,5) "NT Domain : "
AT (6,5) "Logon Server : "
AT (7,5) "OS : "
AT (8,5) "Service Pack : "

Color y+/n
AT (2,20) @userid ; macro's for user and network identification text strings
AT (3,20) @fullname
AT (4,20) @wksta
AT (5,20) @domain
AT (6,20) @lserver ; Lists the authenticating server
AT (7,20) @ProductType
AT (8,20) @CSD
AT (11,65) ; Moves the cursor to the end of the message


Top
#122507 - 2004-07-10 07:08 PM Re: Basic / Bone head logon script
Dellirious Offline
Fresh Scripter

Registered: 2004-07-05
Posts: 5
Loc: NW Ohio
Like that additional stuff for the login. I will incorporate some of that into my login.

Concerning 9x users. I should have no more 9x computers in a week or two, so I am only focusing on NT users.
_________________________
Love what you do and you will never work a day in your life.

Top
#122508 - 2004-07-11 05:04 AM Re: Basic / Bone head logon script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
SETTIME requires SetSystemTime or Power User privileges, thus shouldn't be used in login scripts. Also, under NT/2000/XP/2003 it is recommended to use the Windows Time service. SETTIME would only be necessary for Windows 9x support.
_________________________
There are two types of vessels, submarines and targets.

Top
#122509 - 2004-07-11 05:12 PM Re: Basic / Bone head logon script
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Also, if memory serves, there is a specific permission you can set for setting time on a workstation.

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#122510 - 2004-07-11 05:16 PM Re: Basic / Bone head logon script
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
...but the permission to set time is restricted for a reason. Users should not have permission to change system time. That should be done by the NOS. AD is very sensitive to bad time and so takes care of the time automagically.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#122511 - 2004-07-11 05:25 PM Re: Basic / Bone head logon script
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Kent: that is the SetSystemTime security permission. However, one should really use the time service for this.
_________________________
There are two types of vessels, submarines and targets.

Top
Page 1 of 1 1


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

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.069 seconds in which 0.024 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