Hi, here is the amended code:

Code:
;************************************************************
;************************************************************
;**                                                                                                               **
;**           NetCare4 - D5PS2Z0J Login System                                     **
;**                     Netlogon.NET                                                                  **
;**                                                                                                               **
;**                                                                                                               **
;**           Credits from KiXtart Bulletin Board Forum:                           **
;**           Benny69, gargoyle, exodus3320, Shawn, NTDOC,               **                                                           
;************************************************************
;************************************************************ 

;**************************
;** Dim some global vars **
;**************************
Dim $frmForm
Dim $fraBanner, $fraForm 
;Dim $prgProgress 
Dim $Hour
;**************************
;** Set some global vars **
;**************************
$strVersion = "v4.2.09"
$LSD = @scriptdir 
$WaitTime = 1			
$Blanker = "                                  "	

;******************
;**  START HERE  **
;******************                      

CheckDLL()

;Create NetCare Object
$System = CreateObject("Kixtart.System")
;Verify NetCare Object was created
If Not $System
	$nul= MessageBox("NetCare Not Initiated."+@CRLF+
	                 "Please Verify netcare.dll is installed."+@CRLF+
	                 "This Script Will Now Close.","Error...",16)
   Quit()
EndIf

;***************
;** Main form **
;***************
$frmForm = $System.Form()
$frmForm.Text = "NetCare"+ $strVersion - "D5PS2Z0J Logon System "
$frmForm.SysMenu = 0
$frmForm.Height = 350
$frmForm.Width = 500
$frmForm.FontName = "ariel"
$frmForm.FontSize = 10

;*************
;**  Banner **
;*************	
$fraBanner = $frmForm.Controls.Add("PictureBox")
$fraBanner.Image = @Scriptdir + "\finalbanner.jpg"
$fraBanner.BackColor = $frmForm.RGB(255,255,255)
$fraBanner.Width = $frmForm.Width - 4
$fraBanner.Height = 106
$fraBanner.Left = -2
$fraBanner.Top = -2

;************************
;** Draw On the banner **
;************************
$fraBanner.FontSize = 20
$fraBanner.FontName = "ariel"
$fraBanner.FontBold = 1
$fraBanner.FontItalic = 1
$fraBanner.ForeColor = $frmForm.RGB(0, 100, 200)
$fraBanner.PrintXY (10,0,"Netlogon on @WKSTA")
$fraBanner.FontItalic = 0
$fraBanner.FontSize = 12
$fraBanner.ForeColor = $frmForm.RGB(0,0,0)
$fraBanner.PrintXY (10,35,$strVersion +"   Powered by NetCare Engine (Shamil Nunhuck) ")
$fraBanner.FontSize = 12
$fraBanner.PrintXY (10,55,"@DAY @MDAYNO @MONTH @YEAR")
$fraBanner.FontBold = 0
$fraBanner.FontSize = 10

;******************
;** Progress Bar **
;******************
$prgProgress = $frmForm.Controls.Add("ProgressBar")
$prgProgress.Width = $frmForm.Width - 10
$prgProgress.Left = 2
$prgProgress.Height = 20
$prgProgress.Top = 290;$frmForm.Height - $prgProgress.Height - 5
$prgProgress.Style = 1

;****************
;** Main Frame **
;****************
$fraMain = $frmForm.Controls.Add("PictureBox")
$fraMain.BackColor = $frmForm.RGB(245,245,245)
$fraMain.Width = $frmForm.Width 
$fraMain.Height = 182 ;$frmForm.Height - $fraBanner.Height - 35
$fraMain.Left = -2
$fraMain.Top = $fraBanner.Height - 5

$lblJob = $fraMain.Controls.Add("label")
$lblJob.FontSize = 10
$lblJob.FontName = "ariel"
$lblJob.Top = 100
$lblJob.Width = 440 ;fraMain.Width - 20
$lblJob.Left = 10

$lblTask = $fraMain.Controls.Add("label")
$lblTask.FontSize = 10
$lblTask.FontName = "ariel"
$lblTask.Top = 130
$lblTask.Width = 440 ;fraMain.Width - 20
$lblTask.Left = 50

;***********************
;** Draw on the frame **
;**     Greeting      **
;***********************
$Hour = Val(Trim(Left(@Time,2)))
If $Hour < 12
	$Greeting = "Good Morning"+ @userid+ "("+@priv")"
Else 
	If $Hour < 17
		$Greeting = "Good Afternoon"+ @userid+ "("+@priv")"
	Else
		$Greeting = "Good Evening" + @userid+ "("+@priv")"
	EndIf
EndIf
$Date = "@DAY +@MDAYNO +@MONTH +@YEAR "
$fraMain.FontSize = 13
$fraMain.FontName = "ariel"
$fraMain.FontBold = 1
$fraMain.ForeColor = $frmForm.RGB(0,100,200)
$fraMain.PrintXY (10,10,$Date)
$fraMain.PrintXY (10,40,$Greeting)

$fraMainLabel = $fraMain.Controls.Add("Label")
$fraMainLabel.BackColor = $frmForm.RGB(245,245,245)
$fraMainLabel.FontSize = 13
$fraMainLabel.FontBold = 1
$fraMainLabel.ForeColor = $frmForm.RGB(0,100,100)
$fraMainLabel.Left = 10
$fraMainLabel.Text = "Please wait while you logon script executes..."
$fraMainLabel.Top = 70
$fraMainLabel.Width = $frmForm.Width

$frmForm.Center
$frmForm.Show 

Prep()
sleep 1
MapDrives()
DoAudit()
DoAntiVirus()
Time()
LogUser()
Snd()

Sleep 0.5
$fraMainLabel.Text = "Logon has been successful."
Sleep 3
ExitScript()

While $frmForm.Visible
	$=Execute($frmForm.DoEvents())
Exit 0

;*******************
;** End Main Form **
;*******************

Function CheckDLL()
	;*************************************************
	;** Check that netcare.DLL is registered and   **
	;**         copy and register if not            **
	;*************************************************
	
	;$ReturnCode = KeyExist("HKEY_CLASSES_ROOT\KixTart.Form\CLSID")
	$ReturnCode = KeyExist("HKEY_CLASSES_ROOT\Kixtart.System\CLSID")
	
	If  $ReturnCode = 0								
														
		$SourceFile = @scriptdir + "\netcare.dll"
		$Value = ReadValue("HKLM\System\CurrentControlset\Control\Windows", "SystemDirectory") 
		$Destination = ExpandEnvironmentVars($Value) 
		Copy $SourceFile $Destination
														
		$CMDLine = "regsvr32 /s " + $Destination + "\netcare.dll"
		$ObjShell = CreateObject("WScript.Shell")
		$ObjShell.run($CMDLine, 1, true)
														
		$ObjShell = ""
	EndIf
	;** Wait for registration to take effect
	
EndFunction

Function DoProgress($Step)
	$prgProgress.Value = $prgProgress.Value + $Step
EndFunction

Function Prep()
	$lblJob.Text = $Blanker
	$lblJob.Text = "Preparing for logon"
	DoProgress(5)
	Sleep 0.5
EndFunction 

Function MapDrives()
	$lblJob.Text = $Blanker
	$lblJob.Text = "Mapping Network Drives... "
	
	Use * /DELETE

;** Common mappings: Everyone gets these **

	Sleep $WaitTime
	DoProgress(5)
    $DriveToMap = @HomeShr 
	$lblTask.Caption = $Blanker
	$lblTask.Caption = $DriveToMap
	USE U: @HomeShr						;** Map U: to HomeDir Share
	DoProgress(5)

	$DriveToMap = "\\sdc5400\mfl"
	$lblTask.Caption = $Blanker
	$lblTask.Caption = $DriveToMap
	USE L: $DriveToMap						;** Map L: to SharedRes Share
	DoProgress(5)

	$DriveToMap = "\\sdc5400\sharedres"
	$lblTask.Caption = $Blanker
	$lblTask.Caption = $DriveToMap
	USE R: $DriveToMap						;** Map R: to SharedRes Share
	DoProgress(5)

	$DriveToMap = "\\sdc5400\pcapps"
	$lblTask.Caption = $Blanker
	$lblTask.Caption = $DriveToMap			
	USE P: $DriveToMap							;** Map T: to PcApps Share
DoProgress(5)
	$DriveToMap = "\\sdc5400\cdroms"
	$lblTask.Caption = $Blanker
	$lblTask.Caption = $DriveToMap
	USE V: $DriveToMap							;** Map V: to CDRoms Share
DoProgress(5)
	IF INGROUP("SIMSUsers")         ;** User belongs to SIMSUsers Group
						
		$DriveToMap = @LServer + "\Simsarea"
		$lblTask.Caption = $Blanker
		$lblTask.Caption = $DriveToMap
		USE S: $DriveToMap						;** Map S: to SIMSArea
DoProgress(5)
;		$DriveToMap = "\\SQLxxxx\Simsarea"
;		$lblTask.Caption = $Blanker
;		$lblTask.Caption = $DriveToMap
;		USE S: $DriveToMap							;** Map W: to Students Share
;		Sleep $WaitTime
;		$prgProgress.value = $prgProgress.value + 5

	ENDIF								
	
	IF INGROUP("Staff")	;** User belongs to Staff group						
	
		$DriveToMap = "\\rdc5400\students"
		$lblTask.Caption = $Blanker
		$lblTask.Caption = $DriveToMap
		USE W: $DriveToMap							;** Map W: to Students Share
DoProgress(5)
		$DriveToMap = "\\sdc5400\shared"
		$lblTask.Caption = $Blanker
		$lblTask.Caption = $DriveToMap
		USE O: $DriveToMap							;** Map O: to Old Work Area
DoProgress(5)

ENDIF
	
	IF INGROUP("Domain Admins")
	
		$DriveToMap = "\\rdc5400\NetAdmin"
		$lblTask.Caption = $Blanker
		$lblTask.Caption = $DriveToMap
		USE N: $DriveToMap							;** Map P: to pcapps Share
DoProgress(5)	
		$DriveToMap = "\\rdc5400\Menus"
		$lblTask.Caption = $Blanker
		$lblTask.Caption = $DriveToMap
		USE M: $DriveToMap							;** Map R: to sharedres Share
DoProgress(5)	
	ENDIF	
	


	EndFunction
Function DoAudit()
	$fraMain.fontsize = 10
	$lblJob.Text = $Blanker
	$lblJob.Text = "Running Workstation Audit... "
	
	;AUDIT STUFF IN HERE
	;
	;Audit what????
	;
	; Hardware: (Check for changes?)
	; Installed Software (Check for changes?)
                                                          
	$lblTask.Text = $Blanker
	$lblTask.Text = "Hardware"
	Sleep $WaitTime
	DoProgress(5)
	
	$lblTask.Text = $Blanker
	$lblTask.Text = "Software"
	Sleep $WaitTime
	DoProgress(5)
EndFunction
Function LogUser()
	$lblJob.caption = $Blanker
	$lblJob.caption = "Collecting Logon Info... "
	
	
	;** Dim some vars
	$LogFolder = @scriptdir + "\logs\"			
	
	;** Path to log dir
	$FileName = @month  + "--"+ "log.txt"		

	;** Get Log File Name
	$MyFile = $LogFolder + $FileName				

	;** Set full path to file
	$CRLF= Chr(13) + Chr(10)  					

	;** Set Carriage Return + Line feed
	$MyDateTime = @DATE + " : " + @TIME			

	;** Date and time string
	DoProgress(10)
	                                                                               
	If Open(1,$MyFile,5) = 0 					
		;** Open file for write. Create if doesn't exist
		;** Date And time
		$Silent = WriteLine (1, $MyDateTime + $CRLF)   
		$lblTask.Caption = $Blanker
		$lblTask.Caption = "Time and Date"
		Sleep $WaitTime
		DoProgress(10)
		
		;** User Details
		$Silent = WriteLine (1, "User: " + @USERID + " Full Name: " + @FULLNAME + $CRLF);Write data to file
		$lblTask.Caption = $Blanker
		$lblTask.Caption = "User Name"
		Sleep $WaitTime
		DoProgress(10)
		
		;** IP 0
		$Silent = WriteLine (1, "IP: " + @IPAddress0 + $CRLF)  
		$lblTask.Caption = $Blanker
		$lblTask.Caption = "IP Address"
		Sleep $WaitTime
		DoProgress(15)
		
		$Silent = WriteLine (1, $CRLF) 
										
		$Silent = Close (1)                             
	EndIf
	Sleep 0.5
EndFunction

Function DoAntiVirus()
	$lblJob.Text = $Blanker
	$lblJob.Text = "Updating Antivirus... "
	$lblTask.Text = " CANNOT UPDATE ANTIVIRUS"
	$lblTask.Text = $Blanker
	DoProgress(10)
sleep 0.5
	EndFunction

Function Time()
	;======= Sync Time Local Time Server 
	$lblJob.Text = $Blanker
	$lblJob.Text = "Synchronizing time with SWGfL NTP (Time) Server "
	$lblTask.Text = $Blanker
	$lblTask.Text = " CANNOT PERFORM SYNC"
	DoProgress(15)
;	If Exist (@scriptdir+"\netlogon\TimeSync.bat")
;		Shell @scriptdir+"\netlogon\TimeSync.bat"
	
;	EndIf
sleep 1
EndFunction

Function Snd()
	$lblTask.Text = $Blanker
    $lblTask.Text = "Welcome to " + @WKSTA
	DoProgress(10)
    $fraMainLabel.Text = "Logon has been successful."	
	DoProgress(10)
    $lblJob.Text = $Blanker
	$lblJob.Text = ""
	Play @scriptdir + "logon.wav"


EndFunction

Function ExitScript()
	Quit()
EndFunction

;*****************
;** End of File **
;*****************



Still with the USE error. I was just wondering, why does it fail at the second drive mapping: L: ($DriveToMap = "\\sdc5400\mfl")


Edited by 04nunhucks (2007-01-27 12:15 PM)