[Samba] limiting netlogon scripts to a subnet?-will this work?

Robert Schetterer robert at schetterer.org
Mon Jul 4 12:35:32 GMT 2005


John H. schrieb:

>Would this work?  The problem is, I do not have
>roaming profiles in use(As it is not practical for us,
>as users tend to use the same computers).  I want only
>users with IP from 192.168.1.x to load the databases.
>
>The loaddatabases.cmd file in question would contain
>
> 	rem Grab IP address and dump to a file
>ipconfig >"%userprofile%\ipconfig.txt"
> 	echo Checking for your location
>
>findstr "192.168.1" "%userprofile%\ipconfig.txt"
>if errorlevel 1 goto notLoading
>echo Loading Databases ....
>rd /S /Q C:\Access\Databases
>xcopy /C /Y /K /F /Z /Q /E /H Q:\Access\FrontEnds
>C:\Access\Databases\
>goto end
>
>:notLoading
>echo Not loading Databases
>goto :end
>
>:end
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>  
>
hi,
time ago i wrote a netlogon script
that checks the ip of the inloging client
to match a vpn net and do not install printers drivers , this was for
win 2000 german version, it isnt what you looking for but may help to 
setup equal
jobs

@echo off
REM we look if the login is from vpn range

ipconfig |FIND "IP" |FIND "." > %temp%.\$
for /F "tokens=2 delims=:" %%I in (%temp%.\$) do set IP=%%I
del %temp%.\$
set IP=%IP:~1%
echo IP=%IP%

REM 10.10.3.0 is a login via vpn pptpd net ip

Set | Find "IP=10.10.3." > NUL
If ErrorLevel 1 GoTo Check
GoTo End

REM now we will see if the loging machine matches our office, cause we 
have different printer autoinstalls for different offices, which are 
reflected by the clients name

:Check
Echo COMPUTERNAME=%COMPUTERNAME%

Set | Find "COMPUTERNAME=LAPRD" > NUL

If ErrorLevel 1 GoTo Next
GoTo FOUND


:Next
Echo COMPUTERNAME=%COMPUTERNAME%

Set | Find "COMPUTERNAME=WSRD" > NUL

If ErrorLevel 1 GoTo Next2
GoTo FOUND

:Next2
REM Echo match not found
REM pause
GoTo End

:FOUND
REM Ok the logged in machine belongs to our office, check if the user 
belongs to our office
ifmember /v /l "DOMAINAME\rdusers"
REM ok the machine matches our office , the user matches our office lets 
give him the printers
if errorlevel 1 call rdprinstall.bat


GoTo End

:End

Best Regards


More information about the samba mailing list