WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Logon Issues

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

NT Login Script Example from User

Keywords:     NT Login	 winlogon

Question:

Does you have some sample NT login scripts? Being new to WinBatch, I need to get a head start on learning how to use the network functions. Thanks!

Answer:

I have cut and pasted some pieces of a login script that I did on a consulting project that gathers client information and writes to a central location. This isn't complete (It's rather large). It should give you plenty of ideas though. Here are some pointers:
  1. You will soon find that if your DLL's aren't located on your clients PC, you will need to be creative in how you design your scripts to run quickly.

  2. If the opportunity presents itself, distribute your DLL's to client system directory.

  3. A small network compiled .exe can be called from existing login scripts.

  4. If you have 95 clients you will need to path to your .exe so the connection doesn't get dropped while processing.
;=================cut======================

IntControl(1002,0,0,0,0)
AddExtender("WWNET34I.DLL")

LGHDR="Atlanta - ETC. ETC"
Loginmess=""
Loginmess=strcat("Logging In toATTALRPS Domain")

Display(3,"%LGHDR%","%Loginmess%")

td=TimeDate() 
date=StrSub(td,6,8)
time=StrSub(td,14,9)
date=StrTrim(date)
time=StrTrim(time)
network=netinfo(0)
wsysinfo=WinSysInfo()
sysname=ItemExtract(1,wsysinfo,"")
proc=ItemExtract(6,wsysinfo,"")
osys=WinMetrics(-4)
usrfree=WinResources(2)
os=""

If osys == 4 
   os = "NT"
   user=RegQueryValue(@REGMACHINE, "SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\[DefaultUserName]")
Else
   os = "95"
   user=RegQueryValue(@REGMACHINE, "Network\Logon\[UserName]")
EndIf

mem=WinResources(11)/1024

FileWrite(wtlf,"%date% %time% %user% %sysname% %opsys% %cpu% %mem%%cdrom%")
FileClose(wtlf)

Drop(TotalSize,DriveReport,Drives,NextDrive)
NetAddDrive(@default,@default,"\\whatever\servedapps","n:",@false)
NetAddDrive(@default,@default,"\\whatever2\userfiles","o:",@false)

exit

Another NT Logon Script Example:

Z_TEST=IntControl(1004,0,0,0,0)             ; get full pathname for this exe
Z_NTLOGDIR=StrCat(FilePath(Z_TEST),"..\")   ; remember the pathname only

if StrScan(Z_NTLOGDIR,":",2,@BACKSCAN)>0    ; if path is mapped to a drive
 Z_TEST=StrSub(Z_NTLOGDIR,1,2)              ; get the drive letter...
 if WinMetrics(-4)==4                       ; from Windows NT
  AddExtender("WWWNT32I.DLL")
  Z_NTLOGDIR=StrCat(wNTGetCon(Z_TEST),"\")  ; ...and convert it to a UNC
 else 
  if WinMetrics(-4)==5                      ; or from Windows 95
   AddExtender("WWW9532I.DLL")
   Z_NTLOGDIR=StrCat(w95GetCon(Z_TEST),"\") ; ...and convert it to a UNC
  endif
 endif
endif

Z_TEST=StrScan(Z_NTLOGDIR,"\",3,@FWDSCAN)   ; now, scan the UNC and ...
Z_NTLOGSRV=StrSub(Z_NTLOGDIR,1,Z_TEST-1)    ; ...remember the server name
Message("Login Server",Z_NTLOGSRV)

Article ID:   W13514
Filename:   NT Login Script Example.txt
File Created: 2001:04:03:15:46:26
Last Updated: 2001:04:03:15:46:26