Page 1 of 1 1
Topic Options
#61837 - 2002-01-03 01:46 PM Upgraded to Kix 4.01 (064) and drive mappings stopped
David Nicholls Offline
Fresh Scripter

Registered: 2002-01-02
Posts: 24
Loc: London, UK
Has anyone seen this? Amongst other things from the main script I enumerate global group membership and then run scripts which are .kix


Top
#61838 - 2002-01-03 02:30 PM Re: Upgraded to Kix 4.01 (064) and drive mappings stopped
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
could you specify little bit more of the exact problem.
which part of your script (if you might put on the board) is failing.
from which version did you upgrade?

waiting for your reply,

_________________________
!

download KiXnet

Top
#61839 - 2002-01-03 05:02 PM Re: Upgraded to Kix 4.01 (064) and drive mappings stopped
David Nicholls Offline
Fresh Scripter

Registered: 2002-01-02
Posts: 24
Loc: London, UK
I upgraded from 3.63 (straight forward .exe swap). I'm not using RPC.

The scripts worked fine earlier! And it now runs through as though its all ok. It runs a bit too quick to determine was is happening. There doesnt seem to be anything it disagrees with. I've put the DOS bat and the main kix scripts below. I've not included any of the global group named ones as there are 179 of them! and they are a simple 'use x: "\\server\share"'

+++++++++++++++++++++++++++++++++++++++++++++
The inital DOS bat
@echo off

REM For Windows NT 4.0 ONLY
REM If Windows 95 is detected then it will exit

IF "%OS%" == "Windows_NT" GOTO WinNT
REM * If can't detect WinNT, assume system is Win95/98

net use h: /home
%windir%\kix32.exe camden95.kix
GOTO end


:WinNT

%0\..\kix\KIX32.EXE camden.kix
ECHO Login Script Complete

:end
EXIT


+++++++++++++++++++++++++++++++++++++++++++++
The Kix script

;********************************************************************
;* London Borough of Camden *
;* NT Workstation Master Logon Script *
;* Kixtart v3.45 Source *
;* *
;* Ammended by: David Nicholls Ext: 4839 *
;* Filename:CAMDEN.KIX *
;********************************************************************
;* Description *
;* ----------- *
;* This is the master logon script for all users, *
;* *
;********************************************************************
;* Last Updated:18th June 2000 *
;********************************************************************

;Declare Global Variables

GLOBAL $site,$siteserver,$department,$departmentID
GLOBAL $osVersion,$osRole,$osSPack
GLOBAL $HKLM, $HKCU, $SCCSS
GLOBAL $NICother

; Useful for any Registry Stuff
$HKLM = 'HKEY_LOCAL_MACHINE'
$HKCU = 'HKEY_CURRENT_USER'
$SCCSS = 'SYSTEM\CurrentControlSet\Services'

SetConsole(SHOW)

;**********
; Break On
;**********

;+++++ Need to add some code to determine site link speed +++++


; ===================================================================
; Determine IP address and hence location (site)

; Get 1st IP address of local machine
; There will be problems with multihomed devices
; Get the dotted quads from the IP of the workstation as seperate variables
; The by analysing for 10.y.x.x associate a site with a value of y
; Sites are defined similar to the Exchange model

$ipQuad1 = VAL(SUBSTR(@IPADDRESS0,1,3))
$ipQuad2 = VAL(SUBSTR(@IPADDRESS0,5,3))
$ipQuad3 = VAL(SUBSTR(@IPADDRESS0,9,3))
$ipQuad4 = VAL(SUBSTR(@IPADDRESS0,13,3))

SELECT
CASE $ipQuad1 = 10
SELECT
CASE ($ipQuad2 = 0) OR (($ipQuad2 >= 130) AND ($ipQuad2 <= 139))
$site = "Cressy Road"
CASE ($ipQuad2 = 1) OR ($ipQuad2 = 2) OR (($ipQuad2 >= 140) AND ($ipQuad2 <= 149))
$site = "Town Hall"
CASE ($ipQuad2 = 4) OR (($ipQuad2 >= 150) AND ($ipQuad2 <= 159))
$site = "Camden Town"
CASE ($ipQuad2 = 5) OR (($ipQuad2 >= 160) AND ($ipQuad2 <= 169))
$site = "Crowndale"
CASE 1
$site = "unknown"
ENDSELECT
CASE $ipQuad1 = 172
CASE $ipQuad2 = 20
$site = "DialIn"

CASE 1
$site = "unknown"
ENDSELECT

; "I have detected your location as " + $site ?

; Now having determined the site of the logon device by IP address we need to assign a server
; with a hidden file point
; The small amount of extra space on the local (b)DCs should suffice

SELECT
CASE $site = "Cressy Road"
$siteserver = "\\cornt-dc03\SCRIPTS$"
CASE $site = "Town Hall"
$siteserver = "\\cornt-dc04\SCRIPTS$"
CASE $site = "Camden Town"
$siteserver = "\\cornt-bdcsoc\SCRIPTS$"
CASE $site = "Crowndale"
$siteserver = "\\cornt-dc05\SCRIPTS$"
CASE $site = "unknown" ; treat unknown sites as Cressy Road
$siteserver = "\\cornt-dc03\SCRIPTS$"
CASE 1
$siteserver = "\\cornt-dc03\SCRIPTS$" ; if this is reached then something has gone wrong!!
ENDSELECT

; ===================================================================
; Determine Department

; Now evaluate department of user - could be useful for some script passing
; Requries that a user has a correctly formed login ID (AAABBNN) AAA= Departmental ID
; There is bound to be some who will mess this up! Note ITD should not be treated as CHX
; Remember to do some exclusion checking before using department

$departmentID=SUBSTR(@USERID,1,3)

SELECT
CASE $departmentID = "CHX"
$department = "Chief Executives"
CASE $departmentID = "EDU"
$department = "Education"
CASE $departmentID = "ENV"
$department = "Environment"
CASE $departmentID = "HOU"
$department = "Housing"
CASE $departmentID = "LCS"
$department = "Leisure"
CASE $departmentID = "SOC"
$department = "Social Services"
CASE $departmentID = "MEM"
$department = "Members"
CASE 1
$department = "Unknown"
; "You have a badly named user ID, please contact your Departmental IT Unit to have it corrected" ?
ENDSELECT

; "You are a member of " + $department + " Department" ?


; ===================================================================
; Determine OS

; A few variables and shortcuts with defaults
$osRole = "Unknown"
$osVersion = "Unknown"
$osVersionNo = "Unknown"
$osSPack = 0
$osCSDVersion = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","CSDVersion")
$osVersionNo = ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion","CurrentVersion")
$osRoleKey = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions"

SELECT

; Unknown OS
CASE @inwin = 0
$osVersion = "Unknown"

; NT Family of products, i.e NT and 2K
CASE @inwin = 1

; IF version 5 then 2k, default assume(if version 4 then) NT
IF $osVersionNo = "5.0"
$osVersion = "2000"
ELSE
$osVersion = "NT"
ENDIF

; So what is its role in life?

SELECT
CASE readvalue("$osRoleKey","ProductType") = "LanmanNT"
$osRole = "DC"
CASE readvalue("$osRoleKey","ProductType") = "ServerNT"
$osRole = "SVR"
CASE readvalue("$osRoleKey","ProductType") = "WinNT"
$osRole = "WKS"
ENDSELECT

; Now for the telling of 95 vs. 98 (not bothered with Me or variants of 95, 98)

CASE @inwin = 2
IF @dos = "4.0"
"Windows 95"
$osVersion = "95"
ENDIF
IF @dos = "4.10"
"Windows 98"
$osVersion = "98"
ENDIF
ENDSELECT

; Might as well get service pack number

$osSPack = Substr($osCSDVersion, Len($osCSDVersion) -1, 2)

; End of OS Determination
; ===================================================================
; Print Stuff to Screeen

CLS
small
Color b+/n
BOX (0,0,24,79,GRID) ; 'background grid'
Color b/n
BOX (8,21,18,61,Å) ; 'shadow' of the box
Color c+/n
BOX (7,20,18,60,FULL)

Color r+/n
AT (9,25) "Welcome Back @fullname"

Color w+/n
AT (11,25) "Privilege : "
AT (12,25) "Workstation : "
AT (13,25) "IP Address : "
AT (14,25) "Logon Server : "
AT (15,25) "Location : "
AT (16,25) "Department : "
Color r+/n
AT (17,22) "PLEASE WAIT WHILE LOGON IS VALIDATED"

Color y+/n
AT (11,40) @priv
AT (12,40) @wksta
AT (13,40) @IPADDRESS0
AT (14,40) @lserver
AT (15,40) $site
AT (16,40) $department
Color g+/n

; ===================================================================
; Home drives and call to other scripts
; Delete Drive Forceablly! but land the cmd somewhere safe like %systemroot%

CD "%systemdrive%"
USE "*" /delete
USE "*" /delete /PERSISTENT

;$mappedreg="HKEY_CURRENT_USER\Network\"

;$Index = 0
;:mappedloop1
; $KeyName = ENUMKEY($mappedreg,$Index)
; If @ERROR = 0
; ? " Drive found:" + $KeyName
; If $KeyName <> ""
; $RC = DELTREE($Location+"\"+$KeyName)
; $Index = $Index + 1
; goto mappedloop1
; ENDIF
; Endif

IF @HOMESHR <> ""
USE H: @HOMESHR
ENDIF


;Check for Global Group Specific Script and Execute If Present
;Enumerate and run accoding to Gloabl Group Membership
;We really need a way to ensure departmental Group Scripts run before regular Global Group Scripts
;We really need a way to ensure departmental Group Scripts run before regular Global Group Scripts
;Best way at the moment would seem to be:- a case select then a regular one with excludes

SELECT
CASE $department = "Chief Executives" ; make exceptions for ITD
IF INGROUP ("ITD Users") = 1
CALL "%LOGONSERVER%\NETLOGON\SCRIPTS\GROUPS\ITD Users.kix"
ELSE
CALL "%LOGONSERVER%\NETLOGON\SCRIPTS\GROUPS\Chief Execs Users.kix"
ENDIF
CASE $department = "Education" ; IF they logged on to Camden Domain...

CASE $department = "Environment"
IF INGROUP ("Env Parking") = 1
CALL "%LOGONSERVER%\NETLOGON\SCRIPTS\GROUPS\Env Parking.kix"
ELSE
CALL "%LOGONSERVER%\NETLOGON\SCRIPTS\GROUPS\Env Dept Users.kix"
ENDIF

CASE $department = "Housing"
CALL "%LOGONSERVER%\NETLOGON\SCRIPTS\GROUPS\Housing.kix"

CASE $department = "Leisure"
IF INGROUP ("Leisure Libraries") = 1 ; Make exceptions for Libraries - DMZ
CALL "%LOGONSERVER%\NETLOGON\SCRIPTS\GROUPS\LEISURE LIBRARIES.KIX"
ELSE
CALL "%LOGONSERVER%\NETLOGON\SCRIPTS\GROUPS\Leisure Users.kix"
ENDIF

CASE $department = "Social Services"
CALL "%LOGONSERVER%\NETLOGON\SCRIPTS\GROUPS\Social Services.kix"

CASE $department = "Members" ; Not sure whats done yet

CASE 1

ENDSELECT

AT (17,22) "GLOBAL GROUP MEMBERSHIP "

$Index = 0
DO
$Group = EnumGroup($Index)

AT (17,22) "Group : $Group "
IF EXIST("%LOGONSERVER%\NETLOGON\SCRIPTS\GROUPS\$Group.kix") =1

IF
($Group<>"ITD Users") AND
($Group<>"Chief Execs Users") AND
($Group<>"Env Dept Users") AND
($Group<>"Env Parking") AND
($Group<>"Housing") AND
($Group<>"Leisure Users") AND
($Group<>"Leisure Libraries") AND
($Group<>"Social Services")

AT (17,22) "RUNNING GLOBAL GROUP SCRIPTS "
Call "%LOGONSERVER%\NETLOGON\SCRIPTS\GROUPS\$Group.kix"
ENDIF
ENDIF
$Index = $Index + 1
UNTIL LEN($Group) = 0

;Maybe here have a scripts for each department based on the UserID disection earlier


;Check to see if a script exists for an individual user
;If it does then execute said script

AT (17,22) "CHECKING FOR USER SPECIFIC SCRIPT "

If Exist("%LOGONSERVER%\NETLOGON\SCRIPTS\Users\@USERID.kix") =0
AT (17,22) "NO USER SPECIFIC SCRIPT FOUND "
Else
AT (17,22) "EXECUTING USER SCRIPT "
Call "%LOGONSERVER%\NETLOGON\SCRIPTS\Users\@USERID.kix"
EndIf


; Now remind the user that their password will expire shortly

$age = @maxpwage - @pwage

IF $age < 5
IF $age >= 0
; " Password Age " + @pwage ?
; " Maxmimus Pwage " + @maxpwage ?
; " Password will expire in " + $age + " day(s)"
MESSAGEBOX ("You password will expire in $age day(s). Please change it now."+ chr(10) + "Users of 3Com LanModems are reminded to change that password also." + chr(10) + "Any problems please contact the helpdesk on ext 4321","Priorty Message", 4112, 0)
ENDIF
ENDIF

; Log to see if EPO service .exe is installed on the local machine

$epologs = "\\CRPNT-AV01\ALERTS$\"

IF EXIST("%SYSTEMDRIVE%\EPOAgent\naimas32.exe")=0
IF OPEN ( 1 , $epologs + "logon.txt" , 5 ) = 0
$x = WriteLine ( 1 , @DATE + "," + @TIME + "," + @WKSTA + "," + @IPADDRESS0 + "," + @USERID + "," + @DOMAIN + "," + $osVersion + "," + $osRole + "," + $osSPack + "," + "NOEPO" + Chr(13) + Chr(10) )

ELSE
? "OOPS!" ?
ENDIF

IF CLOSE (1)
ENDIF

ENDIF

; Collect WINS Details
; Have to get NIC details (if multiple NICs - don't process but log - at the moment jsut look at 1st network card
; Then use the NIC details to get NetBT stuff i.e WINS
; But only for NT 4 machines, 2000 would require maching of {GUID} numbers

$NicType= "x"
$winsA = "x"
$winsB = "x"
$winsDHCPA = "x"
$winsDHCPB = "x"
$winsList = "x"

$NicType= readvalue('$HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\1','ServiceName')

; Test for second NIC interface
$ReturnCode = ExistKey ('$HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\2')

If $ReturnCode = 0
$NICother = "y"
Else
$NICother = "n"
Endif

if $osVersion = "NT"

; $ReturnCode = ExistKey ('$HKLM\$SCCSS\NetBT\Adapters\$NicType\NameServer')
; if $ReturnCode=0
$winsA= readvalue('$HKLM\$SCCSS\NetBT\Adapters\$NicType','NameServer')
; else
; $winsA= "x"
; endif

; $ReturnCode = ExistKey ('$HKLM\$SCCSS\NetBT\Adapters\$NicType\NameServerBackup')
; if $ReturnCode=0
$winsB= readvalue('$HKLM\$SCCSS\NetBT\Adapters\$NicType','NameServerBackup')
; else
; $winsB= "x"
; endif

; $ReturnCode = ExistKey ('$HKLM\$SCCSS\NetBT\Adapters\$NicType\DHCPNameServer')
; if $ReturnCode=0
$winsDHCPA= readvalue('$HKLM\$SCCSS\NetBT\Adapters\$NicType','DHCPNameServer')
; else
; $winsDHCPA= "x"
; endif

; $ReturnCode = ExistKey ('$HKLM\$SCCSS\NetBT\Adapters\$NicType\DHCPNameServerBackup')
; if $ReturnCode=0
$winsDHCPB= readvalue('$HKLM\$SCCSS\NetBT\Adapters\$NicType','DHCPNameServerBackup')
; else
; $winsDHCPB= "x"
; endif

ELSE
$NicType2k= "Tcpip_" + $NicType
$winsList= readvalue('$HKLM\$SCCSS\NetBT\Parameters\Interfaces\$NicType2k','NameServerList')
; Tidy up Win2k output

ENDIF
$winslogs = "\\camden-pdc\logs$\"
IF OPEN ( 1 , $winslogs + "winslog.csv" , 5 ) = 0
$y = WriteLine ( 1 , @DATE + "," + @TIME + "," + @WKSTA + "," + @IPADDRESS0 + "," + @USERID + "," + @DOMAIN + "," + $NicType + "," + $winsA + "," + $winsB + "," + $winsDHCPA + "," + $winsDHCPB + "," + $winsList + "," + $NICother + Chr(13) + Chr(10) )
ELSE
? "OOPS!" ?
ENDIF
IF CLOSE (1)
ENDIF


Exit 1

Top
#61840 - 2002-01-06 12:37 AM Re: Upgraded to Kix 4.01 (064) and drive mappings stopped
JohnGH Offline
Fresh Scripter

Registered: 2002-01-03
Posts: 27
Well I think the problem is that Kix 4.01 combined Local and Global groups in the Enum Group function.
The enumgroup will produce Domain\Group for global groups and just the group name for localgroups.

So I guess what you should do is change:
IF
($Group<>"ITD Users") AND
($Group<>"Chief Execs Users") AND
($Group<>"Env Dept Users") AND
($Group<>"Env Parking") AND
($Group<>"Housing") AND
($Group<>"Leisure Users") AND
($Group<>"Leisure Libraries") AND
($Group<>"Social Services")

into

IF
(SubStr($Group,"ITD Users")=0) AND
(SubStr($Group,"Chief Execs Users")=0) AND
(Substr($Group,"Env Dept Users")=0) AND
and so on. The Substr() will check if the group name contains "ITD Users" and return the position of the string or 0 if it isn't found.

John

[ 05 January 2002: Message edited by: JohnGH ]

Top
#61841 - 2002-01-06 12:44 AM Re: Upgraded to Kix 4.01 (064) and drive mappings stopped
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
and also use $$ for the hidden drive $
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#61842 - 2002-01-07 01:37 PM Re: Upgraded to Kix 4.01 (064) and drive mappings stopped
David Nicholls Offline
Fresh Scripter

Registered: 2002-01-02
Posts: 24
Loc: London, UK
Thanks for the InGroup info. I've done it using Split on the $group variable and testing for UBOUND = 1 and the 0th element is the account domain. Never know what local group names are on one of the 4000 workstations out there!

The $$ instead of $ ? Didn't see that documented anywhere... whats the reason for the change?

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
0 registered and 837 anonymous users online.
Newest Members
ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder, M_Moore
17887 Registered Users

Generated in 0.12 seconds in which 0.095 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