Home

Search this site:
 

Horshack’s
very
own site

 

This is Bavaria, Germany!
You will find links to Perl,
bootdisks for system administration,
a lot of Linux,
Windows administration
and some personal belongings.
Loginscripts using with Windows NT (without Kixtart)

Loginscripts using with WindowsNT
without Kixtart

There are some things to do while logging into a Domain with WindowsNT:

  1. syncing time to PDC
  2. Mapping common drives for all users
  3. Mapping special drivers for users depending on the membership of groups

The following Script does all this. It works with ingrp32.exe, a program from a former Kixtart which checks wether someone is in a NT-group or not. A script doing much more and working with Kixtart can be found here.

 

What reason are there to write the thing without Kixtart?

First, there are some disadvantages: no changing of PATH-variable, no tricking around with your registry, not getting so much data from the computer (i.e. MAC-Address).
But there are a few advantages too... If installation happens beyond your being there from people you don't know, it's easier for them to find a DOS-batch and maintain it than to find a script written in a language they have never heard before...

 


@echo off
rem this script has the name: logon.bat
rem english version 1
rem 
rem loginscript for nt/95-client with checking the user being in a group
rem if so a drive will be mapped (in the future, if I can: setting 
rem and enhancing PATH and other variables in all DOS-sessions the user
rem starts)
rem if the drive is already mapped (i.e. through the user in her graphical
rem shell) the mapping is deleted first before set new.

rem ATTENTION:
rem There are a few things to be this way that all works:
rem 1. the file "ingrp32.exe" is in  %SYSTEMROOT%\system32\repl\import\scripts
rem 2. this file is there too
rem 3. the user has this file as his loginscript (usermanager-user xy-profile-
rem      startupscript-name: logon.bat)

rem the next things for ALL users

rem ==== setting time=========================================================
rem ATTENTION! For setting the time locally the user needs the rights to
rem do this (usermanager-german: "richtlinien"-change systemtime)
net time \\lena /set /yes


rem ==== mapping drives for all users =========================================
set drive=f
set newshare=\\lena\public
if not exist %drive%:\nul goto alle1
	net use %drive%: /delete
:alle1
net use %drive%: %newshare% /persistent:no


set drive=t
set newshare=\\lena\tmp
if not exist %drive%:\nul goto alle1
	net use %drive%: /delete
:alle1
net use %drive%: %newshare% /persistent:no



rem ===== mapping drive  ===============================
rem is user in the local group "Administrators"?
rem error 0 = not member
rem error 1 = member in global group
rem error 2 = member in local group
rem error 3 = API failure
rem


rem is the user in this group?
set askgroup=staff1
rem if yes, map this
set drive=L
rem with this share
set newshare=\\lena\homelisa
@echo on
ingrp32.exe %askgroup%
if not errorlevel 2 goto notingrp1
	echo %USERNAME% is member in group %askgroup%
	rem delete mapping if it exists yet
	if not exist %drive%:\nul goto connect1
		net use %drive%: /delete
:connect1
	net use %drive%: %newshare% /persistent:no
	goto allok1
:notingrp1
	echo %USERNAME% is NOT member in group %askgroup%
:allok1

rem Another way to solve the problem: ifmember.exe
rem is the user in this global group?
set askgroup=winworduser
rem if yes, map this
set drive=M
rem with this share
set newshare=\\lena\winword
@echo on
%logonserver%\netlogon\ifmember.exe %askgroup%
if X%errorlevel%==X0 goto afterwinword
@echo Your are member of group %askgroup%
net use q: /delete
net use q: %newshare%
:afterwinword

rem show which netressources are used
net use





     




Other places to view when looking for Loginscripts:

Very good login-scripts to look on provides Steve Wilson at http://netnet.net/~swilson/kix/ed.html.
Take a look at this page when you like to write loginscripts with Kixtart.


 


back to WinNT-Software page
last modified: October 6th, 2000 mail to me
Impressum