Page 1 of 1 1
Topic Options
#111715 - 2004-01-13 07:50 AM Will this login script work?
Mandy Offline
Lurker

Registered: 2004-01-13
Posts: 3
Hi..I'm new to this and I havnt got a server set up to test it (yet) Part of it is out of a book, some from here and I removed all the statements cos I want to put that into a file on its own..

Can anyone see anything wrong with this script..?

If @dos >= "5.0"
$hklms = 'HKEY_LOCAL_MACHINE\SOFTWARE'
If 1 <> ReadValue($hklms+"\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync")
$ = WriteValue ($hklms+"\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync", "1", "REG_DWORD")
EndIf
EndIf


If @INWIN=1
GoTo SETVARNT
Else
GoTo SETVAR95
EndIf

:SETVAR95
Shell "winSET.exe USERNAME=@USERID"
Shell "winSET.exe ADDRESS=@ADDRESS"
Shell "winSET.exe COMPUTER=@WKSTA"
Shell "winSET.exe DOMAIN=@DOMAIN"
Shell "winSET.exe COMMENT=@COMMENT"
Shell "winSET.exe FULLNAME=@FULLNAME"
Shell "winSET.exe HOMEDIR=@HOMEDIR"
Shell "winSET.exe HOMESHR=@HOMESHR"
Shell "winSET.exe LSERVER=@LSERVER"
Shell "winSET.exe PRIV=@PRIV"

GoTo STAGE2

:SETVARNT
;SET varibles on NT clients using SET command

Set USERNAME="@USERID"
SETM ADDRESS="@ADDRESS"
SETM COMPUTER="@WKSTA"
SETM DOMAIN="@DOMAIN"
Set COMMENT="@COMMENT"
Set FULLNAME="@FULLNAME"
Set HOMEDIR="@HOMEDIR"
Set HOMESHR="@HOMESHR"
Set LSERVER="@LSERVER"
Set PRIV="@PRIV"

:STAGE2
;synchronizing with timeserver
SetTime \\S01
EndIf

;delete any previous drive mappings and check for errors
Use "*" /DELETE
EndIf

;MAP Drives By Group Membership
;Map common drives for Domain Users

If InGroup ("Domain") = 1
Use S: \\S01\shared
Use P: \\S01\programs
Use H: @HOMESHR

EndIf

Call LOGSCREEN.SRC


Top
#111716 - 2004-01-13 08:06 AM Re: Will this login script work?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22343
Loc: OK
basically yes.
as kixtart is forgiving about the quotes, it does not complaint about your use statements but according to syntax rules, all string constants should be in quotes.

the var part also little confuses me.
first, as far as I know, kix should nowadays work fine on win9x and thus the winset shouldn't be needed.
there were some changes in 4.12 and 4.21 for that.
so, you should make a script without the goto part and use global stuff instead.

and finally, according to docs, correct syntax for set is:
SET "variable=string"


then, out of curiocity (is it pronounced like that?), I'd like to know which book you've been reading.

thanks and cheers.
_________________________
!

download KiXnet

Top
#111717 - 2004-01-13 08:23 AM Re: Will this login script work?
Mandy Offline
Lurker

Registered: 2004-01-13
Posts: 3
Reading Windows server 2003 by Mark Minasi
Top
#111718 - 2004-01-13 09:52 AM Re: Will this login script work?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11577
Loc: CA
My guess is this is Chris G.
Oh, and Welcome to the board.

Anyways... Here is my input on this.


It is more difficult to use the SetOption NoVarInStrings setting, but it will force you
to make sure your script coding is written better.

Code:
Break On

Dim $iRC
$iRC=SetOption('Explicit','On')
$iRC=SetOption('NoVarsInStrings','On')

Dim $HKLMSMWNTCV,$,$LocalAdmin
If @DOS >= '5.0'
$HKLMSMWNTCV = 'HKLM\Software\Microsoft\Windows NT\CurrentVersion'
$LocalAdmin = InGroup(@wksta+'\'+SidToName('S-1-5-32-544'))-1+@INWIN

; Server 2003 should use a GPO to set this sync option
; If GPO not used the user logging on must have Admin rights to modify this key
; I would check if the user is an Admin
;If 1 <> ReadValue($hklms+"\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync")
If $LocalAdmin
; Just writing the key each time without checking the current value is faster
$ = WriteValue ($HKLMSMWNTCV + '\Winlogon', 'RunLogonScriptSync', 1, 'REG_DWORD')
EndIf
EndIf

; As Lonkero said these settings should not be needed anymore
; Using the GOTO statement is legal, but frowned upon in general
;If @INWIN=1
;GoTo SETVARNT
;Else
;GoTo SETVAR95
;EndIf

;:SETVAR95
;Shell "winSET.exe USERNAME=@USERID"
;Shell "winSET.exe ADDRESS=@ADDRESS"
;Shell "winSET.exe COMPUTER=@WKSTA"
;Shell "winSET.exe DOMAIN=@DOMAIN"
;Shell "winSET.exe COMMENT=@COMMENT"
;Shell "winSET.exe FULLNAME=@FULLNAME"
;Shell "winSET.exe HOMEDIR=@HOMEDIR"
;Shell "winSET.exe HOMESHR=@HOMESHR"
;Shell "winSET.exe LSERVER=@LSERVER"
;Shell "winSET.exe PRIV=@PRIV"

;GoTo STAGE2

;:SETVARNT
;SET varibles on NT clients using SET command

;Set USERNAME="@USERID"
;SETM ADDRESS="@ADDRESS"
;SETM COMPUTER="@WKSTA"
;SETM DOMAIN="@DOMAIN"
;Set COMMENT="@COMMENT"
;Set FULLNAME="@FULLNAME"
;Set HOMEDIR="@HOMEDIR"
;Set HOMESHR="@HOMESHR"
;Set LSERVER="@LSERVER"
;Set PRIV="@PRIV"

;:STAGE2
;synchronizing with timeserver
SetTime \\S01
;EndIf

;delete any previous drive mappings and check for errors
Use "*" /DELETE /PERSISTENT
; I did not follow all the IF statements, but looks like you may have one or more EndIf without If
;EndIf

;MAP Drives By Group Membership
;Map common drives for Domain Users

; Not positive but I think DOMAIN is a reserved word.
; InGroup checks group membership. You can use something like
; $MyDomain = @DOMAIN
; If $MyDomain='PHOTOSRUS'
;If InGroup ("Domain") = 1

Use S: '\\S01\shared'
Use P: '\\S01\programs'
; Test and make sure @HOMESHR returns the expected value before attempting to map it
Use H: @HOMESHR

EndIf

; By default KiXtart uses .KIX and .SCR (however screen saver modules also use .SCR
; It would probably be better to get in the habit of using either .KIX or maybe something like
; .KXW (for WKIX32.EXE) and .KXD (for KIX32.EXE) or just .KIX in general
Call LOGSCREEN.SRC


Top
#111719 - 2004-01-13 05:12 PM Re: Will this login script work?
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
The GOTOs should be removed and the SET statements would belong into the appropriate IF-ELSE-ENDIF sections.

RunLogonScriptSync can also be implemented on a per-user setting if the user is not admin but should be deployed via LPO/GPO.
_________________________
There are two types of vessels, submarines and targets.

Top
#111720 - 2004-01-14 01:19 AM Re: Will this login script work?
Mandy Offline
Lurker

Registered: 2004-01-13
Posts: 3
Hey Thanks for your help, I will go through the manual and hopefully piece it together. Now I have something I know is going to work, it's a little easier..

Question:

What is this part of the script doing?

Break On
Dim $iRC
$iRC=SetOption('Explicit','On')
$iRC=SetOption('NoVarsInStrings','On')

**The "Domain" I just put there instead of the real group name. I was planning to change it back..

Top
#111721 - 2004-01-14 01:53 AM Re: Will this login script work?
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11577
Loc: CA
Look at the setoption in the manual for further information.

It basically sets directives for the KIX executable on how to read and parse the script.

If you want further information on it please let us know.

Also don't forget that ScriptLogic maintains a compiled help file of the KiXtart manual and I have a compiled help file on my site as well for other KiXtart information.

SCRIPTLOGIC
http://www.scriptlogic.com/kixtart/

HTML Help File 4.22
http://209.50.244.178/downloads/kix/kixtart422.chm

KIXHELP KORG-FAQ
http://www.kixhelp.com/
http://www.kixhelp.com/Downloads/KORG-FAQ.chm

Top
#111722 - 2004-01-14 02:30 AM Re: Will this login script work?
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
A few comments... sme of which have already been said.
Your SetTime and WriteValue() requires additional rights. You should use the W32tm sevice to sync time and policies to RunLogonScriptSync.

Why do you need to set all those environment vars? WinSet.exe is not needed for Wintendos if using the current version of KiX.

You should include the /Persistent switch with:
Use "*" /DELETE /Persistent

The If InGroup() statements don't need the = 1 on the end.

All the USE commands should have quotes around the paths.

There are two ENDIFs that don't have corresponding IFs.

The CALL should include a full path or @ScriptDir before the filename.

Restructure your IF statements to avoid GOTOs.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 162 anonymous users online.
Newest Members
Jodey, Hiker, GTRoberts, KatieQuinn, Brennnnn
17684 Registered Users

Generated in 0.035 seconds in which 0.012 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