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

Loginscripts using with WindowsNT

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

  1. Mapping common drives for all users
  2. Mapping special drivers for users depending on the membership of groups
  3. changing the Screensaver so that it demands your password to let you work again

The following Script does all this. It works with Kixtart, a scripting language for Windows which supports a lot of useful things, i.e.:

and a loooot of things more.
Newest version of Kixtart always can be found at http://www.xs4all.nl/~akhw/winnt.htm or here on my own server (last version I worked with was Version 3.35 from March, 17th 1997). In the meantime I use PERL as my loginscript for my whole NT-domain.

 


; file    : logon.scr
; version : 1.01 at 2000/10/18
; author  : Richard Lippmann
;
; Ziel   : - common mapping of networkdrives for all users in LAN
;          - mapping by group membership
;          - appendix of PATH-variable by group membership
;
; Preconditions: 
;    1. Script is tested under WinNT4/german!
;    2. There must be the following files in %SYSTEMROOT%\system32\repl\import\scripts
;         KIX32.EXE, mind V3.35 (kix32 /?)
;         KX32.DLL
;       and this file: logon.scr
;    3. Call this script via usermanager-username-profile-loginscript:
;             kix32 logon.scr
;          
; 
;
;
; SYNC LOCAL TIME
SETTIME "LENA"

; ============== Show Logininfo ====================================

; REM DISPLAY BOX FOR ADMINISTRATORS
small
COLOR b+/n
BOX (0,0,24,79,GRID)           
COLOR b/n
BOX (8,16,21,71,GRID)              
COLOR g+/n
BOX (7,15,20,70,FULL)

; REM DISPLAY NT VARIABLE NAMES
Color w+/n
AT ( 9,20) "Userid       : "   
AT (10,20) "Full name    : "
AT (11,20) "Description  : "
AT (12,20) "Privilege    : "
AT (13,20) "Workstation  : "
AT (14,20) "Address      : "
AT (15,20) "Domain       : "
AT (16,20) "Logon Domain : "
AT (17,20) "Logon Server : "

; REM DISPLAY NT VARIABLES
Color y+/n
AT ( 9,35) @userid             
AT (10,35) @fullname
AT (11,35) @comment
AT (12,35) @priv
AT (13,35) @wksta
AT (14,35) @address
AT (15,35) @domain
AT (16,35) @ldomain
AT (17,35) @lserver
COLOR w/n
AT (19,20) "Wait for 2 seconds."
SLEEP 1
CLS


; ============== Mappings for everyone =====================================

; homedirectory is \\lena\lippmann$$
$server="\\lena"
$user=@userid     
$homeflag="$$"
        

; no homedrives at this site
; USE H: "$server\$user\$homeflag"

use g: "$server\public"
use t: "$server\tmp"



; ============== Mappings for members of group ===========================

$ingruppe="oracleuser"
$newdrive="L"
$share="homelisa"
if ingroup($ingruppe)
	; simply connect, also when there were another connection before
	use $newdrive: "$server\$share"
else
	; remove mapping if network drive was connected
	; (if you _want_ to remove mapping)
	if exist ("$newdrive:\nul")
		use $newdrive: /delete	
	endif
endif


$ingruppe="wwwadmin"
$newdrive="W"
$share="www"
if ingroup($ingruppe)
	; simply connect, also when there were another connection before
	use $newdrive: "$server\$share"
else
	; remove mapping if network drive was connected
	; (if you _want_ to remove mapping)
	if exist ("$newdrive:\nul")
		use $newdrive: /delete	
	endif
endif

use list


; ============= add to PATHvariable for group members ===============

;
; add something to PATHvariable
; made after a script by eegleston@tsmi.iitri.com
; in http://netnet.net/~swilson/kix/ed.html
;
$ingruppe="oracleuser"
$addpath="d:\temp"
if ingroup($ingruppe)
	? "User is in group $ingruppe, add $addpath to PATH"
else
	? "User is not in group $ingruppe: no need to change PATH"
	goto ENDE_PFAD_ORACLE
endif 

; here are the registry settings for path
; you can change this only when the user has adminrights 
; (make them admins for a day!)
$regpathloc="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\"
$regpathloc=$regpathloc+"Session Manager\Environment"
$dummy=ExistKey($regpathloc)
if @ERROR <> 0
	? "Sanity Check: directory for PATH in registry does not exist... "
	? "Cannot change PATH."
else 
	? "Sanity Check: directory for PATH in registry exists... good!"
	$orgpath=Readvalue($regpathloc,"Path")
	; ? "PATH = $orgpath"
	; is the additional path already there?
	$ex=INSTR($orgpath,$addpath)
	if $ex > 0
		; ? $addpath is in PATH already
	else
		$newpath=$orgpath+";$addpath"
		$dummy=WriteValue($regpathloc,"Path",$newpath,"REG_EXPAND_SZ")
		if @ERROR=0
			? "$addpath was added to PATH"
		else
			? "I could not add $addpath to PATH!"
		endif
	endif
endif
:ENDE_PFAD_ORACLE



; ========== Change screensaver and save it with password ============

;
; change screensaver so that its active after  
; $sstimeout seconds and you have to type in a password to activate the computer
? "secure screensaver..."

$RegSSLoc="HKEY_CURRENT_USER\Control Panel\Desktop"
$dummy=ExistKey($RegSSLoc)
if @ERROR <> 0	
	? "SanityCheck: Desktop Key does not exist, "
	? "cannot change screensaver to secure."
else
	; screensaver after 600 seconds
	$sstimeout=600
	; ? "SanityCheck: Desktop Key exists"
	$ssact=Readvalue($RegSSLoc,"ScreenSaveActive")
	$sssec=Readvalue($RegSSLoc,"ScreenSaverIsSecure")
	$sstim=Readvalue($RegSSLoc,"ScreenSaveTimeOut")
	$ssact=Readvalue($RegSSLoc,"ScreenSave.Exe")

	$dummy=WriteValue($RegSSLoc,"ScreenSaveActive","1","REG_SZ")
	if @ERROR=0
		? "Screensaver is active."
	else
		? "Could not activate screensaver."
	endif

	$dummy=WriteValue($RegSSLoc,"ScreenSaverIsSecure","1","REG_SZ")
	if @ERROR=0
		? "Screensaver ist password secured."
	else
		? "I could not password secure screensaver."
	endif

	$dummy=WriteValue($RegSSLoc,"ScreenSaveTimeOut","$sstimeout","REG_SZ")
	if @ERROR=0
		? "Screensaver active after $sstimeout seconds."
	else
		? "Could not set activation time for screensaver."
	endif
endif
    




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 without Kixtart.


 


back to WinNT-Software page
last modified: 2000/10/18 mail to me
Impressum