#64254 - 2002-04-03 09:32 PM
Can you help?
|
Anonymous
Anonymous
Unregistered
|
I have been using Kixtart for a while but I am not much at scripting. I would appreciate any advice as to how I can simplify my login script. Especially with the "IF INGROUP" statements. Here is my kix script. Thanks for the help.
;************************************************************ ;$Variables ;************************************************************
$OS = (@PRODUCTTYPE) $IP = (@IPADDRESS0) $AVIP = val(substr(@ipaddress0, 1, 3)) $DNS = READVALUE ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP", "NAMESERVER") ;************************************************************ ; Setting Time Server ; **********************************************************
SETTIME "\\RSHDR"
;********************************************************** ;Update KIX files ;*********************************************************** IF EXIST (C:\WINDOWS\KX32.DLL) = 0 COPY "\\RSHDR\NETLOGON\*.DLL" "C:\WINDOWS" /H COPY "\\RSHDR\NETLOGON\*.DLL" "C:\WINDOWS\SYSTEM" /H COPY "\\RSHDR\NETLOGON\KIX32.EXE" "C:\WINDOWS" /H COPY "\\RSHDR\NETLOGON\KIX32.EXE" "C:\WINDOWS\SYSTEM" /H ENDIF
;************************************************************* ; Check For Department Group Privileges ;************************************************************* if ingroup(BIOMED) use I: "\\3MAPC\BIOMED$" ENDIF
if ingroup(BUSOFF) use I: "\\3MAPC\BUSOFF$" ;use R: "\\RH_SERVER\CIS" ENDIF
if ingroup(CANCER_CTR) use I: "\\3MAPC\CANCER_CTR$" ENDIF
if ingroup(CARDIOSHR) use I: "\\3MAPC\CARDIO$" ENDIF
if ingroup(Cathlab) use I: "\\3MAPC\CATHLAB$" ENDIF if ingroup(COMPLIANCE) use I: "\\3MAPC\COMPLIANCE$" use J: "\\3MAPC\QUALITY$" ENDIF
if ingroup(DADEVILLE) use I: "\\3MAPC\DADEVILLE$" ENDIF
if ingroup(EDUCATION) use I: "\\3MAPC\EDUCATION$" use J: "\\3MAPC\QUALITY$" ENDIF
if ingroup(ER) use I: "\\3MAPC\ER$" ENDIF
if ingroup(EXECUTIVE) use I: "\\3MAPC\EXECUTIVE$" ENDIF
if ingroup(FISCALSER) use I: "\\3MAPC\FISCALSER$" ENDIF if ingroup(HOSPICE) use I: "\\3MAPC\HOSPICE$" ENDIF
if ingroup(HR) use I: "\\3MAPC\HR$" ENDIF if ingroup(IS) use I: "\\3MAPC\IS$" ENDIF
if ingroup(MAINT) use I: "\\3MAPC\MAINT$" ENDIF
if ingroup(MEDREC) use I: "\\3MAPC\MEDREC$" ENDIF
if ingroup(NURSING) use I: "\\3MAPC\NURSING$" ENDIF if ingroup(RADIOLOGY) use I: "\\3MAPC\RAD$" ENDIF
if ingroup(UR) use I: "\\3MAPC\UR$" ENDIF ;************************************************************* ;Check for Special Group Privileges ;************************************************************* if ingroup(ADMIN) use W: "\\RSH-BG1\PDC$" use X: "\\RSHDR\BDC$" use K: "\\INETGTWY\MSPLOGS$" use J: "\\3MAPC\RMC$" ENDIF
if ingroup(Cath_Rad) use I: "\\3MAPC\CATHLAB$" use J: "\\3MAPC\RAD$" ENDIF
if ingroup(EEG) use K: "\\3MAPC\EEG$" ENDIF
if ingroup(EXECUTIVE) and ingroup(EDUCATION) use K: "\\3MAPC\EXECUTIVE$" ENDIF
if ingroup(HOSPICE_DB) use L: "\\3MAPC\HOSPICE_DB$" ENDIF
if ingroup(INTRANET) and EXIST (C:\WINDOWS\Desktop\RMCINT~1.lnk) = 1 COPY "\\RSHDR\NETLOGON\globe.ico" "C:\WINDOWS" COPY "\\RSHDR\NETLOGON\rmcint~1.url" "C:\WINDOWS\DESKTOP" DEL "C:\WINDOWS\Desktop\RMCINT~1.lnk" ENDIF
if ingroup(INTRANET) and EXIST (C:\WINDOWS\Desktop\rmcedu~1.url) = 0 COPY "\\RSHDR\NETLOGON\rmcedu.ico" "C:\WINDOWS" COPY "\\RSHDR\NETLOGON\rmcedu~1.url" "C:\WINDOWS\DESKTOP" ENDIF
if ingroup(NURSE_MGR) use K: "\\3MAPC\NURSE_MGR$"
ENDIF
if ingroup(NURSE_ORIENTATION) use J: "\\3MAPC\NURSE_ORIENT$" ENDIF if ingroup(PRESSGNY_FULL) use N: "\\3MAPC\PRESSGANEY$" ENDIF if ingroup(PFT) use P: "\\3MAPC\PFT$" ENDIF
if ingroup(PFT_Archv) use O: "\\3MAPC\PFT_Archv$" ENDIF
if ingroup(PRESSGNY_READ) use N: "\\3MAPC\PRESSGANEY$" ENDIF
if ingroup(SELF_PAY) use K: "\\3MAPC\SELF_PAY$" ENDIF
if ingroup(TIMETRAK) use L: "\\3MAPC\TIMETRAK$" ENDIF if ingroup(NURSE_ADMIN) use "*" /DELETE use I: "\\3MAPC\NURSING$" use L: "\\3MAPC\CANCER_CTR$" use M: "\\3MAPC\ER$" use K: "\\3MAPC\NURSE_MGR$" use J: "\\3MAPC\NURSE_ORIENT$" ENDIF
;Letters used=I,J,K,L,M,N,O,P,W,X ;******************************************************************************** ; Map Personal Home Directory / drive to R: ;******************************************************************************** if Exist ("\\3MAPC\@userid$") = 1 use R: "\\3MAPC\@userid$" ENDIF
;******************************************************************************** ;Registry DNS Changes ;******************************************************************************** ;IF $DNS = "199. 0. 66. 6" ; ? "DONE" ;ELSE ; WRITEVALUE ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP", "NAMESERVER", "199. 0. 66. 6", "REG_SZ") ;ENDIF
;******************************************************************************** ;User Logging to \\3MAPC\LOG$ ;******************************************************************************** $filename="@userid";+"@TIME" $key="@date"+" @time" $outfile="\\3mapc\log$\@Day\$filename.txt" $log = @date, @ipaddress $rc1 = WriteProfileString($outfile,"$key","__IPAddress","@IPADDRESS0") $rc2 = WriteProfileString($outfile,"$key","__UserName","@USERID") $rc3 = WriteProfileString($outfile,"$key","__WorkStationName","@WKSTA") $rc4 = WriteProfileString($outfile,"$key","__LastLogin","@Time") $rc5 = WriteProfileString($outfile,"$key","__DNS","$DNS") $rc6 = WriteProfileString($outfile,"$key","__OperatingSystem","@PRODUCTTYPE")
;******************************************************************************** ;SynapseAE Security ;******************************************************************************** IF "@userid" = synapseae SENDMESSAGE (ME, @IPADDRESS0 + " logged in as SYNAPSEAE") ENDIF
;******************************************************************************** ;Antivirus Install ;******************************************************************************** if $AVIP = "128" RUN "\\3mapc\OFCSCAN\AUTOPCC.exe" ELSE ENDIF
;********************************************************************************
COOKIE1 EXIT
|
|
Top
|
|
|
|
#64256 - 2002-04-04 05:47 PM
Re: Can you help?
|
Radimus
Moderator
   
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
to paraphrase Lon...
if you have groups that are exclusionary...(UK sales, US Sales, Asia Sales) then you can use select/case
code:
select case ingroup("UK Sales") use h: "\\UKserver\sales" case ingroup("US Sales") use h: "\\USserver\sales" etc... endselect
otherwise if/endif is about the simplest methodology...
|
|
Top
|
|
|
|
#64257 - 2002-04-07 01:36 AM
Re: Can you help?
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
We have take a look at your script. First some comment on it:
- line 213 is calling an unknown macro "@ipaddress" instead of "@ipaddress0"
- don't install kixtart binaries by this script. it will return a share violation
problem. so remove
code:
IF Exist (c:\windows\kx32.dll) = 0 COPY "\\RSHDR\NETLOGON\*.DLL" "C:\WINDOWS" /h COPY "\\RSHDR\NETLOGON\*.DLL" "C:\WINDOWS\SYSTEM" /h COPY "\\RSHDR\NETLOGON\KIX32.EXE" "C:\WINDOWS" /h COPY "\\RSHDR\NETLOGON\KIX32.EXE" "C:\WINDOWS\SYSTEM" /h ENDIF
and add to your BATch file f.e. our iexpress package of KiXtart call %0\..\kix402update.exe /q - the variables $os and $ip aren't referenced in your script.
those lines can be removed. - replace IF/ENDIF by SELECT/CASE/ENDSELECT structures when possible.
- replace Ingroup(biomed) by Ingroup("biomed") <> 0
- be aware of possible mapping problem with USE i: "\\3MAPC\CATHLAB$".
- use quotations in your INGROUP, EXIST statements.
- use $$ instead of $ notation in your USE commands. $ has
special meanings in Kixtart. - move $avip and $dns part to the right place.
- remove $log = @date, @ipaddress0. no reference to it.
- your WriteProfileString creates an enormous amount of files which
are hard to combine. To see how you can create historical and dynamic list based on date see our script logon.kix which you can find on our site.
Our version
code:
;************************************************************ ; Setting Time Server ; **********************************************************
SETTIME "\\RSHDR"
;********************************************************** ;Update KIX files by "0\..\kix402update /q" ;***********************************************************
;************************************************************* ; Check For Department Group Privileges ;*************************************************************
SELECT CASE InGroup("biomed") <> 0 USE i: "\\3MAPC\BIOMED$$" CASE Ingroup("busoff") <> 0 USE i: "\\3MAPC\BUSOFF$$" ;USE R: "\\RH_SERVER\CIS" CASE Ingroup("cancer_ctr") <> 0 USE i: "\\3MAPC\CANCER_CTR$$" CASE Ingroup("cardioshr") <> 0 USE i: "\\3MAPC\CARDIO$$" CASE Ingroup("cathlab") <> 0 USE i: "\\3MAPC\CATHLAB$$" CASE Ingroup("compliance") <> 0 USE i: "\\3MAPC\COMPLIANCE$$" USE j: "\\3MAPC\QUALITY$$" CASE Ingroup("dadeville") <> 0 USE i: "\\3MAPC\DADEVILLE$$" CASE Ingroup("education") <> 0 USE i: "\\3MAPC\EDUCATION$$" USE j: "\\3MAPC\QUALITY$$" CASE Ingroup("er") <> 0 USE i: "\\3MAPC\ER$$" CASE Ingroup("executive") <> 0 USE i: "\\3MAPC\EXECUTIVE$$" CASE Ingroup("fiscalser") <> 0 USE i: "\\3MAPC\FISCALSER$$" CASE Ingroup("hospice") <> 0 USE i: "\\3MAPC\HOSPICE$$" CASE Ingroup("hr") <> 0 USE i: "\\3MAPC\HR$$" CASE Ingroup("is") <> 0 USE i: "\\3MAPC\IS$$" CASE Ingroup("maint") <> 0 USE i: "\\3MAPC\MAINT$$" CASE Ingroup("medrec") <> 0 USE i: "\\3MAPC\MEDREC$$" CASE Ingroup("nursing") <> 0 USE i: "\\3MAPC\NURSING$$" CASE Ingroup("radiology") <> 0 USE i: "\\3MAPC\RAD$$" CASE Ingroup("ur") <> 0 USE i: "\\3MAPC\UR$$" ENDSELECT
;************************************************************* ;Check for Special Group Privileges ;************************************************************* IF Ingroup("admin") <> 0 USE w: "\\RSH-BG1\PDC$$" USE x: "\\RSHDR\BDC$$" USE k: "\\INETGTWY\MSPLOGS$$" USE j: "\\3MAPC\RMC$$" ENDIF IF Ingroup("cath_rad") <> 0 USE i: "\\3MAPC\CATHLAB$$" USE j: "\\3MAPC\RAD$$" ENDIF IF Ingroup("eeg") <> 0 USE k: "\\3MAPC\EEG$$" ENDIF IF Ingroup("executive") <> 0 AND Ingroup("education") <> 0 USE k: "\\3MAPC\EXECUTIVE$$" ENDIF IF Ingroup("hospice_db") <> 0 USE l: "\\3MAPC\HOSPICE_DB$$" ENDIF IF Ingroup("intranet") <> 0 AND Exist("c:\windows\desktop\rmcint~1.lnk") = 1 COPY "\\RSHDR\NETLOGON\globe.ico" "C:\WINDOWS" COPY "\\RSHDR\NETLOGON\rmcint~1.url" "C:\WINDOWS\DESKTOP" DEL "C:\WINDOWS\Desktop\RMCINT~1.lnk" ENDIF IF Ingroup("intranet") <> 0 AND Exist("c:\windows\desktop\rmcedu~1.url") = 0 COPY "\\RSHDR\NETLOGON\rmcedu.ico" "C:\WINDOWS" COPY "\\RSHDR\NETLOGON\rmcedu~1.url" "C:\WINDOWS\DESKTOP" ENDIF IF Ingroup("nurse_mgr") <> 0 USE k: "\\3MAPC\NURSE_MGR$$" ENDIF IF Ingroup("nurse_orientation") <> 0 USE j: "\\3MAPC\NURSE_ORIENT$$" ENDIF IF Ingroup("pressgny_full") <> 0 USE n: "\\3MAPC\PRESSGANEY$$" ENDIF IF Ingroup("pft") <> 0 USE p: "\\3MAPC\PFT$$" ENDIF IF Ingroup("pft_archv") <> 0 USE o: "\\3MAPC\PFT_Archv$$" ENDIF IF Ingroup("pressgny_read") <> 0 USE n: "\\3MAPC\PRESSGANEY$$" ENDIF IF Ingroup("self_pay") <> 0 USE k: "\\3MAPC\SELF_PAY$$" ENDIF IF Ingroup("timetrak") <> 0 USE l: "\\3MAPC\TIMETRAK$$" ENDIF IF Ingroup("nurse_admin") <> 0 USE "*" /delete USE i: "\\3MAPC\NURSING$$" USE l: "\\3MAPC\CANCER_CTR$$" USE m: "\\3MAPC\ER$$" USE k: "\\3MAPC\NURSE_MGR$$" USE j: "\\3MAPC\NURSE_ORIENT$$" ENDIF ;Letters used=I,J,K,L,M,N,O,P,W,X
;******************************************************************************** ; Map Personal Home Directory / drive to R: ;********************************************************************************
IF Exist("\\3MAPC\@userid$$") = 1 USE r: "\\3MAPC\@userid$$" ENDIF
;******************************************************************************** ;Registry DNS Changes ;********************************************************************************
;IF (ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP","NAMESERVER") = "199. 0. 66. 6") ; ? "DONE" ;ELSE ; $null=WriteValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP","NAMESERVER","199. 0. 66. 6","REG_SZ") ;ENDIF
;******************************************************************************** ;User Logging to \\3MAPC\LOG$ ;********************************************************************************
$filename="@userid";+"@TIME" $key="@date"+" @time" $outfile="\\3mapc\log$$\@day\"+$filename+".txt" ; $rc1=WriteProfileString($outfile,"$key","__IPAddress",@ipaddress0) $rc2=WriteProfileString($outfile,"$key","__UserName",@userid) $rc3=WriteProfileString($outfile,"$key","__WorkStationName",@wksta) $rc4=WriteProfileString($outfile,"$key","__LastLogin",@time) $rc5=WriteProfileString($outfile,"$key","__DNS",ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP","NAMESERVER")) $rc6=WriteProfileString($outfile,"$key","__OperatingSystem",@producttype)
;******************************************************************************** ;SynapseAE Security ;********************************************************************************
IF "@userid" = synapseae SendMessage(me,""+@ipaddress0+" logged in as SYNAPSEAE") ENDIF
;******************************************************************************** ;Antivirus Install ;********************************************************************************
IF (Val(Substr(@ipaddress0, 1, 3)) = "128") RUN "%comspec% /c \\3mapc\OFCSCAN\AUTOPCC.exe" ENDIF
;********************************************************************************
COOKIE1 EXIT
;($begin) ; ; sat 06-apr-2002 17:25:48 (kix 4.00 vs 3.01e) ; ;Informative KIXSTRIP: no errors found (input=237 output=237 skip=0). ; ;Summary KIXSTRIP: block structures ; - do:until [0:0] ; - for|each:in|to:step|next [0|0:0|0:0|0] ; - function:endfunction [0:0] ; - if:else:endif [39:1:39] ; - select:case:endselect [0:0:0] ; - while:loop [0:0] ;Informative KIXSTRIP: 39 block_structures found. ;Informative KIXSTRIP: no UDF's found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ;Informative KIXSTRIP: 1 EXIT ;Informative KIXSTRIP: 1 RUN ;Informative KIXSTRIP: 45 USE ; ;($end)
greetings. [ 07 April 2002, 01:37: Message edited by: MCA ]
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 696 anonymous users online.
|
|
|