Page 1 of 1 1
Topic Options
#58117 - 2001-08-09 05:34 PM Advice for logging roaming users on
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
Hi everyone! Been an abosolute age since i've posted anything on here. I see its still going strong as ever and also getting better.

Anyway i'm just after a bit of advice from some of you as you seem to be kinda like all rounders. Here goes.

We have several sites throughout the company and each site has a specific script that the users run. This is the logonscript that we run here at Stoke:

code:

@ECHO OFF
SET SERVER=STOKE
REM Verifying / Updating Script Software Installation, Please Wait...

IF "%OS%" == "Windows_NT" GOTO WinNT

%windir%\command\XCOPY %0\..\KIX\KIX32.EXE %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\KIX\KX16.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\KIX\KX32.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
%windir%\command\XCOPY %0\..\KIX\KX95.DLL %WINDIR%\SYSTEM\ /D /H /I /R /V > NUL
REM Loading Logon Script, Please Wait...
%windir%\system\kix32.exe \\%server%\sys\programs\logon\loginset.kix
CLS
GOTO End

:WinNT
XCOPY %0\..\KIX\KIX32.EXE %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
XCOPY %0\..\NTUtils\igrant.exe %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
XCOPY %0\..\NTUtils\rmtshare.exe %WINDIR%\SYSTEM32\ /D /H /I /R /V > NUL
REM Loading Logon Script, Please Wait...
%WINDIR%\SYSTEM32\KIX32.EXE \\%server%\sys\programs\logon\loginset.kix
CLS
GOTO end

:End
EXIT


This is the loginset.kix that is called from the above script.

; Kix32 script to do standard login tasks for Windows
CLS

code:

USE F: /DELETE
USE F: \\%SERVER%\SYS
USE P: /DELETE
USE P: \\%SERVER%\SYS
USE W: /DELETE
USE W: \\%SERVER%\SYS
USE X: /DELETE
USE X: "\\%CDLIBRARY%\CDLIBRARY"

IF INGROUP("None TCMS Users")
CALL "\\%SERVER%\SYS\PROGRAMS\LOGON\UPDATES.KIX"
ELSE
CALL "\\%SERVER%\SYS\PROGRAMS\LOGON\UPDATES.KIX"
CALL "\\%SERVER%\SYS\PROGRAMS\LOGON\DOWNWIN.KIX"
CALL "\\%SERVER%\SYS\PROGRAMS\LOGON\VECBUILDUPDT.KIX"
CALL "\\%SERVER%\SYS\PROGRAMS\LOGON\TCMSUPDT.KIX"
CALL "\\%SERVER%\SYS\PROGRAMS\LOGON\FIXINI.KIX"
ENDIF

IF @INWIN=2
SETTIME "\\%SERVER%"
SHELL "\\%SERVER%\SYS\PROGRAMS\LOGON\WINSET WIN95=1"
SHELL "\\%SERVER%\SYS\PROGRAMS\LOGON\WINSET SERVER=%SERVER%"
USE U: /DELETE
USE U: "\\%SERVER%\"+@USERID
SHELL "\\%SERVER%\SYS\PROGRAMS\LOGON\WINSET LOGNAME="+UCASE(@USERID)
SHELL "\\%SERVER%\SYS\PROGRAMS\LOGON\WINSET WPC=/@@U-"+UCASE(@USERID)
ELSE
SHELL "%COMSPEC% /E:1024 /C NET TIME \\%SERVER% /SET /Y > NUL"
$NAME = UCASE(@USERID)
SET "LOGNAME=$NAME"
$INT = "/@@U-"+UCASE(@USERID)
SET "WPC=$INT"
ENDIF


The one we use for say our Liverpool office would be identical except for the fact that the server variable would be set to the Liverpool server. Now this works fine for users that do not roam around different offices but the problem arises when we have a user that works from different offices. Say for example Jo Bloggs user is set up in Stoke he runs stokescr.bat which is fine when he is in Stoke as the scripts run at an adequate speed. But if he logs on in Liverpool he still runs the stoke script and connects to the stoke server and pulls any updates from there which can sometimes take ages. Has anybody got any ideas on a away around this? All I want the roaming users to be able to do is when they are in a remote office they just map the drives to their home server but when they are in their home office they run the updates.

I hope I have made some sense here and that you can be of some assistance. Any help or suggestions are welcome. I was thinking of using the slownet.exe command that comes with SMS but that just checks the speed of the logon server which is no help to me.

Thanks

Julian

[ 09 August 2001: Message edited by: Julian ]

Top
#58118 - 2001-08-09 05:53 PM Re: Advice for logging roaming users on
Anonymous
Unregistered


Why not match the @LSERVER to %server%?
IF (%server%=@LSERVER) "do updates" ENDIF

As long as you don't have multiple domain controllers per site... Or even that wouldn't be a problem:

code:
 SELECT
CASE %server%=STOKE
IF (@LSERVER=dcstoke1) OR (@LSERVER=dcstoke2) "do updates" ENDIF
CASE %server%=LIVERPOOL
IF (@LSERVER=dcliverpool1) OR (@LSERVER=dcliverpool2) "do updates" ENDIF
ENDSELECT

You get the picture...
Oh, and in light of another discussion about the speed of kix scripts maybe you should considder defining $LSERVER=@LSERVER at the beginning of the script since the macro's seem to be slower. This was the finding, wasn't it guys?

Top
#58119 - 2001-08-09 06:13 PM Re: Advice for logging roaming users on
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
I did kinda think of that but in some sites we have got two logonservers and the clients seem to choose them at random. That would mean having an identical copy of the updates on both servers unless there is another way around that.

Cheers

Ju

Top
#58120 - 2001-08-10 01:26 PM Re: Advice for logging roaming users on
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
Arrhhhh!!! I can see how it would work now.

Just one other small problem though? Some of our clients in other offices seems intent on using Stoke as their Logonserver. IS there away to force them to use their local server instead of Stokes?

Top
#58121 - 2001-08-13 08:04 PM Re: Advice for logging roaming users on
bleonard Offline
Seasoned Scripter
*****

Registered: 2001-01-19
Posts: 581
Loc: Chicago, IL
Julian -
If your offices are differnet domains, would this not require the user have an ID on each domain? If so, lots of extra work there.

If these are all one domain (BDC's in each office), then copying the updates with NT replication should be possible.

As for the remote connections - you could structure your script to identify if user connected remotely (via @IPADDRESS or @RAS macro's), set a variable (i.e. $Remote = "1"), then run main script sections based upon this variable. I do similar process on my system, though not running RAS server.

Guess I need a little more info on the domain structure to go further.

Bill

Top
#58122 - 2001-08-16 12:02 AM Re: Advice for logging roaming users on
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
Hi sorry took so long to get back to you. We have just the one domain iver 14 sites all connected via leased lines. The running the script depending on IP address sounds promosing actually. We also don not run RAS server.

Any more input would be greatlt appreciated.

Julian

Top
#58123 - 2001-08-16 12:34 AM Re: Advice for logging roaming users on
Anonymous
Unregistered


Like a W2000 domain, implement the site-concept. For that you will have to find your IP default gateway, which normally is set in the DHCP-properties.

Don't know where to find the default gateway but though.

Top
#58124 - 2001-08-16 12:56 AM Re: Advice for logging roaming users on
test_user Offline
Fresh Scripter

Registered: 2000-02-29
Posts: 14
Julian,

Maybe you can give this a try...

; ****************************************************************************************************************
; File name : INVENTRY.SCR
; Description : Additional script for invenory of workstations
; Location :
; ****************************************************************************************************************
; Date | Description | Initiator
; ------------+--------------------------------------------------------------------------+------------------------
; ****************************************************************************************************************


:GetIpInfo
; ------------------------------------------------------------------------------------------
; Get Location by IP
; ------------------------------------------------------------------------------------------

$ipadd0=@IPADDRESS0
$3ebyte = " "

$3ebyte = rtrim(ltrim(substr(@IPADDRESS0,9,3))) ; 3rd octet

SELECT
CASE $3ebyte = "1"
Call Stoke.kix
GOTO End

CASE $3ebyte = "2"
Call Lpool.kix
GOTO End

CASE 1
ENDSELECT

:End
; ****************************************************************************************************************
; End of script
; ----------------------------------------------------------------------------------------------------------------

[ 15 August 2001: Message edited by: test_user ]

Top
#58125 - 2001-08-15 02:09 PM Re: Advice for logging roaming users on
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
How do you mean bergx 'the site cocept'? and can you use KiX to pull the default gateway of a client? If I could do that it shouldnt be a problem or I could also use test_users apporach.


Just another thing is there any reason why you are using CASE here instead of the IF statement?

Top
#58126 - 2001-08-15 02:32 PM Re: Advice for logging roaming users on
test_user Offline
Fresh Scripter

Registered: 2000-02-29
Posts: 14
Julian,

You can use the Case statement to select each of the sites:

Case site1
do site1 script
Case site2
do site2 script
Case site3
do site3 script

etc.

Top
#58127 - 2001-08-15 02:34 PM Re: Advice for logging roaming users on
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
Doh!! Im with ya....yeah I think i'll look into doing it that way. Thanks very much!!
Top
#58128 - 2001-08-15 03:05 PM Re: Advice for logging roaming users on
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
for retrieving the defaultgateway with kix 3.6x use this:
code:

cls
$cardkey=enumkey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards",0)
$cardkey=readvalue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkCards\$cardkey","ServiceName")
$defaultgateway=readvalue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\$cardkey","DefaultGateway")
if len($defaultgateway) < 7 ;no static. trying dhcp:
$defaultgateway=readvalue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces\$cardkey","DhcpDefaultGateway")
endif
;gateway record is multistring so let's reduce it pure ip:
$defaultgateway = rtrim(substr($defaultgateway,1,len($defaultgateway)-1))
? "gateway search results: $defaultgateway"
get $
exit


it retrieves static and DHCP-given entryes.

with kix2001 just do:
$defaultgateway = enumipinfo(0,3)


cheers,

_________________________
!

download KiXnet

Top
#58129 - 2001-08-15 04:11 PM Re: Advice for logging roaming users on
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
hmmmm, tried this with KiX 2001 and it works fine on a 98 client using DHCP but on mine which has a static IP and is NT it doesnt retrieve anything? Am i doing something wrong? Or can it not do this?

im using the exact line you said:

$defaultgateway = enumipinfo(0,3)
? $defaultgateway

no info returned.

any ideas??

oh and when i return the rror it says 50!

[ 15 August 2001: Message edited by: Julian ]

Top
#58130 - 2001-08-15 04:18 PM Re: Advice for logging roaming users on
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there is this remark in kix2001 doc for NT:
quote:
This function is available on Windows XP, Windows 2000 and Windows 9x, but not on Windows NT. Furthermore, this function relies on a correct installation of the IP Helper API which is installed as part of Microsoft Internet Explorer 5.0 and higher. Note that there is a known issue with installing the required DLLs on Windows 9x. Full details on this issue can be found in the following KnowledgeBase article: http://support.microsoft.com/support/kb/articles/Q234/5/73.ASP.[/URL]


the problem is fixed in final release (the dependency is no more!).
before that releasing, this way is not working for NT.
and if you need to get it to work, you need to use scripts like the one I posted.

cheers,

[ 15 August 2001: Message edited by: Lonkero ]

_________________________
!

download KiXnet

Top
#58131 - 2001-08-15 04:20 PM Re: Advice for logging roaming users on
Julian Offline
Starting to like KiXtart

Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
ooops!! i'll read the manual properly next time.
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 1114 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.158 seconds in which 0.111 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