04nunhucks
(Getting the hang of it)
2007-01-26 06:51 PM
Another login script: Error in Use Statement

Hello, when trying to run the following script, the users recieve an error:

ERROR : error in USE statement!
Script: .../netlogon.kix
Line : 234

Code:
;************************************************************
;**              NetLogon Script 4                         **
;**              Powered by KiXforms                       **
;**                                                        **
;**    Script compiled with help from the following        **
;**    members in the KiXtart Forum:                       **
;**    Benny69, Exodus3320, Gargoyle, Shawn                **
;**                                                        **
;**    Original Script by: dpalmer, snunhuck, nau          **
;************************************************************
;**************************
;** 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.Text = $Blanker
    $lblTask.Text = "Home Directory"
	Use U: $DriveToMap		
	DoProgress(2)	
	
	
	$DriveToMap = "\\sdc5400\mfl"
	$lblTask.Text = "MFL"
	Use L: $DriveToMap		
	DoProgress(2)
	
	
	$DriveToMap = "\\sdc5400\sharedres"
	$lblTask.Text = "Shared Resources"
	Use R: $DriveToMap		
	DoProgress(2)
	
	
	$DriveToMap = "\\sdc5400\pcapps"
	$lblTask.Text = "PC Apps"
	Use P: $DriveToMap		
	DoProgress(2)
	
	
	$DriveToMap = "\\sdc5400\cdroms"
	$lblTask.Text = "CD Roms"
	Use V: $DriveToMap		
	DoProgress(2)
	
	
	IF INGROUP("SIMSUsers") 
	$DriveToMap = @LServer + "\Simsarea"
	$lblTask.Text = "SIMS Area"
	Use W: $DriveToMap		
	DoProgress(2)

ENDIF	
	IF INGROUP("Staff")
	$DriveToMap = "\\rdc5400\students"
	$lblTask.Text = "Students"
	Use S: $DriveToMap		
	DoProgress(2)

	
	$DriveToMap = "\\sdc5400\shared"
	$lblTask.Text = "Shared"
	Use O: $DriveToMap		
	DoProgress(2)

	ENDIF
	IF INGROUP("Domain Admins")
	$DriveToMap = "\\rdc5400\NetAdmin"
	$lblTask.Text = "NetAdmin"
	Use N: $DriveToMap		
	DoProgress(2)

	
	$DriveToMap = "\\rdc5400\Menus"
	$lblTask.Text = "Menus"
	Use M: $DriveToMap		
	DoProgress(2)

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 **
;*****************



exodus3320
(Lurker)
2007-01-26 07:11 PM
Re: Another login script: Error in Use Statement

I would just like to point out that I contributed largely to the writing of that code, and specifically to the User Interface elements. For some reason, the person who posted this hasn't mentioned me in the credits/title box in the source code.

Don't make me use upper case!!!


ShawnAdministrator
(KiX Supporter)
2007-01-26 07:27 PM
Re: Another login script: Error in Use Statement

I assume its failing around here:

$lblTask.Text = "MFL"
Use L: $DriveToMap

on the use ? What happens if you comment out the line before it - the $lblTask line - does it make any difference ? If you comment-out the USE line - does the error go completely away ?


04nunhucks
(Getting the hang of it)
2007-01-26 07:30 PM
Re: Another login script: Error in Use Statement

Sorry about that, that was a prototype that the other technician did, as mine was absolutely rubbish. He seemed to have deleted the top half which did have all the credits. I hadn't noticed that until you told me. Thnaks for telling me. I have amended it. Thanks again for reminding me to restore the info at the top.

edit: 18:51 " I have editied it but the credits are just not showing in the code"


04nunhucks
(Getting the hang of it)
2007-01-26 07:48 PM
Re: Another login script: Error in Use Statement

Hello Shawn, I have followed your instructions to no avail. Commenting out $lblTask makes no difference. Commenting out the USE statement just makes it punce on the next USE statement (Use R: $DriveToMap) and gives the same error.

NTDOCAdministrator
(KiX Master)
2007-01-26 07:56 PM
Re: Another login script: Error in Use Statement

Quote:

Warning: Undeclared variable.
Variable Name: $strVersion
In function: Main
Referenced on line: 25

Warning: Undeclared variable.
Variable Name: $LSD
In function: Main
Referenced on line: 26

Warning: Undeclared variable.
Variable Name: $WaitTime
In function: Main
Referenced on line: 27

Warning: Undeclared variable.
Variable Name: $Blanker
In function: Main
Referenced on line: 28

Warning: Undeclared variable.
Variable Name: $System
In function: Main
Referenced on line: 37

Warning: Undeclared variable.
Variable Name: $nul
In function: Main
Referenced on line: 40

Warning: Possible mismatched parenthesis.
In function: Main
Referenced on line: 40
PF=1
40: $nul= MessageBox("NetCare Not Initiated."+@CRLF+

Warning: Possible mismatched parenthesis.
In function: Main
Referenced on line: 42
PF=-1
42: "This Script Will Now Close.","Error...",16)

Warning: Variable referenced inside string.
Variable Name: $strVersion
In function: Main
Referenced on line: 50
50: $frmForm.Text = "NetCare $strVersion - D5PS2Z0J Logon System "

Warning: Undeclared variable.
Variable Name: $prgProgress
In function: Main
Referenced on line: 89

Warning: Undeclared variable.
Variable Name: $fraMain
In function: Main
Referenced on line: 99

Warning: Undeclared variable.
Variable Name: $lblJob
In function: Main
Referenced on line: 106

Warning: Undeclared variable.
Variable Name: $lblTask
In function: Main
Referenced on line: 113

Warning: Undeclared variable.
Variable Name: $Greeting
In function: Main
Referenced on line: 126

Warning: Undeclared variable.
Variable Name: $Date
In function: Main
Referenced on line: 134

Warning: Undeclared variable.
Variable Name: $fraMainLabel
In function: Main
Referenced on line: 142

Warning: Undeclared variable.
Variable Name: $
In function: Main
Referenced on line: 170

Warning: Undeclared variable.
Variable Name: $ReturnCode
In function: CheckDLL
Referenced on line: 184

Warning: Undeclared variable.
Variable Name: $SourceFile
In function: CheckDLL
Referenced on line: 188

Warning: Undeclared variable.
Variable Name: $Value
In function: CheckDLL
Referenced on line: 189

Warning: Undeclared variable.
Variable Name: $Destination
In function: CheckDLL
Referenced on line: 190

Warning: Undeclared variable.
Variable Name: $CMDLine
In function: CheckDLL
Referenced on line: 193

Warning: Undeclared variable.
Variable Name: $ObjShell
In function: CheckDLL
Referenced on line: 194

Warning: Undeclared variable.
Variable Name: $prgProgress
In function: DoProgress
Referenced on line: 204

Warning: Undeclared variable.
Variable Name: $lblJob
In function: Prep
Referenced on line: 208

Warning: Undeclared variable.
Variable Name: $Blanker
In function: Prep
Referenced on line: 208

Warning: Undeclared variable.
Variable Name: $lblJob
In function: MapDrives
Referenced on line: 215

Warning: Undeclared variable.
Variable Name: $Blanker
In function: MapDrives
Referenced on line: 215

Warning: Undeclared variable.
Variable Name: $WaitTime
In function: MapDrives
Referenced on line: 222

Warning: Undeclared variable.
Variable Name: $DriveToMap
In function: MapDrives
Referenced on line: 225

Warning: Undeclared variable.
Variable Name: $lblTask
In function: MapDrives
Referenced on line: 226

Warning: Undeclared variable.
Variable Name: $fraMain
In function: DoAudit
Referenced on line: 291

Warning: Undeclared variable.
Variable Name: $lblJob
In function: DoAudit
Referenced on line: 292

Warning: Undeclared variable.
Variable Name: $Blanker
In function: DoAudit
Referenced on line: 292

Warning: Undeclared variable.
Variable Name: $lblTask
In function: DoAudit
Referenced on line: 302

Warning: Undeclared variable.
Variable Name: $WaitTime
In function: DoAudit
Referenced on line: 304

Warning: Undeclared variable.
Variable Name: $lblJob
In function: LogUser
Referenced on line: 313

Warning: Undeclared variable.
Variable Name: $Blanker
In function: LogUser
Referenced on line: 313

Warning: Undeclared variable.
Variable Name: $LogFolder
In function: LogUser
Referenced on line: 318

Warning: Undeclared variable.
Variable Name: $FileName
In function: LogUser
Referenced on line: 321

Warning: Undeclared variable.
Variable Name: $MyFile
In function: LogUser
Referenced on line: 324

Warning: Undeclared variable.
Variable Name: $CRLF
In function: LogUser
Referenced on line: 327

Warning: Undeclared variable.
Variable Name: $MyDateTime
In function: LogUser
Referenced on line: 330

Warning: Undeclared variable.
Variable Name: $Silent
In function: LogUser
Referenced on line: 338

Warning: Undeclared variable.
Variable Name: $lblTask
In function: LogUser
Referenced on line: 339

Warning: Undeclared variable.
Variable Name: $WaitTime
In function: LogUser
Referenced on line: 341

Warning: Undeclared variable.
Variable Name: $lblJob
In function: DoAntiVirus
Referenced on line: 366

Warning: Undeclared variable.
Variable Name: $Blanker
In function: DoAntiVirus
Referenced on line: 366

Warning: Undeclared variable.
Variable Name: $lblTask
In function: DoAntiVirus
Referenced on line: 368

Warning: Undeclared variable.
Variable Name: $lblJob
In function: Time
Referenced on line: 376

Warning: Undeclared variable.
Variable Name: $Blanker
In function: Time
Referenced on line: 376

Warning: Undeclared variable.
Variable Name: $lblTask
In function: Time
Referenced on line: 378

Warning: Undeclared variable.
Variable Name: $lblTask
In function: Snd
Referenced on line: 389

Warning: Undeclared variable.
Variable Name: $Blanker
In function: Snd
Referenced on line: 389

Warning: Undeclared variable.
Variable Name: $fraMainLabel
In function: Snd
Referenced on line: 392

Warning: Undeclared variable.
Variable Name: $lblJob
In function: Snd
Referenced on line: 394
56 warnings generated, 408 lines processed.


04nunhucks
(Getting the hang of it)
2007-01-26 08:02 PM
Re: Another login script: Error in Use Statement

Hi,

I would like to say that if I replace all of the Drive mappings with
Code:
	$DriveToMap = "\\shamil-2dptm3ss\netlogon"
	$lblTask.Text = $Blanker
    $lblTask.Text = "netlogon"
	Use N: $DriveToMap		
	DoProgress(10)	
	
	Sleep 0.5
	$DriveToMap = "\\shamil-2dptm3ss\cache"
	$lblTask.Text = "SmartCache"
	Use S: $DriveToMap		
	DoProgress(10)
	Sleep 0.5


The code works perfectly fine. (I use this at home). But adding the drive mappings make it fail.

Also, I am sure all the variables are declared at the begninning of the script, NTDOC.


NTDOCAdministrator
(KiX Master)
2007-01-26 08:16 PM
Re: Another login script: Error in Use Statement

Originally Posted By: 04nunhucks
Also, I am sure all the variables are declared at the begninning of the script, NTDOC.


Well declaring the variables is probably not your issue, but they are not declared otherwise these errors would not show.

You also use vars in strings and macros in strings all of which removing and cleaning up might help in the long run to make the code better.

.


04nunhucks
(Getting the hang of it)
2007-01-26 08:27 PM
Re: Another login script: Error in Use Statement

Ok, thanks NTDOC, which one of these would be a macro and a var? Just an example will do; just to refresh my memory.

NTDOCAdministrator
(KiX Master)
2007-01-26 09:03 PM
Re: Another login script: Error in Use Statement

Line 47 has a variable in a string
$frmForm.Text = "NetCare $strVersion - D5PS2Z0J Logon System "

Line 73 has a macro in a string
$fraBanner.PrintXY (10,0,"Netlogon on @WKSTA")


etc...

.


04nunhucks
(Getting the hang of it)
2007-01-26 10:09 PM
Re: Another login script: Error in Use Statement

ah, right thanks, I will amend it asap

04nunhucks
(Getting the hang of it)
2007-01-26 10:20 PM
Re: Another login script: Error in Use Statement

Hello, by clearing up, I interpret that you meand changing it all to either macro or string? Or have I misunderstood NOTDOC?

AllenAdministrator
(KiX Supporter)
2007-01-26 10:31 PM
Re: Another login script: Error in Use Statement


Doc meant cleaning up your code so that you do not have Vars or Macro in your strings...

from:
$frmForm.Text = "NetCare $strVersion - D5PS2Z0J Logon System "
to:
$frmForm.Text = "NetCare " + $strVersion + " - D5PS2Z0J Logon System "

and from:
$fraBanner.PrintXY (10,0,"Netlogon on @WKSTA")
to:
$fraBanner.PrintXY (10,0,"Netlogon on " + @WKSTA)


Gargoyle
(MM club member)
2007-01-26 11:09 PM
Re: Another login script: Error in Use Statement

If you instate the following options at the beginning of your script you will see what they mean real quick

Code:

$RC = Setoption(NoVarsInStrings,ON)
$RC = Setoption(NoMacrosInStrings,ON)
$RC = Setoption(Explicit,ON)



Another really good one is

Code:
If not @logonmode
 Break ON
EndIf


With the first section your script will start screaming (beeping everytime you execute it) until you fix it to comply with all the SetOptions.

Can be frustrating at times, but it does make one a much better coder.


Glenn BarnasAdministrator
(KiX Supporter)
2007-01-26 11:19 PM
Re: Another login script: Error in Use Statement

The errors that Doc displayed were the result of passing your script through the Sanity() udf, which checks for mismatched quotes & parens, undeclared vars or duplicate var definitions. Sanity is also part of the KGen tools.

Sanity also generates a report of variable usage, so you can easily add var declarations in each UDF.

Glenn


04nunhucks
(Getting the hang of it)
2007-01-27 11:42 AM
Re: Another login script: Error in Use Statement

Wow, thanks guys, I am really learning a lot from this. I will post the new script in my next post; just having breakfast!

04nunhucks
(Getting the hang of it)
2007-01-27 12:13 PM
Re: Another login script: Error in Use Statement

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")


LonkeroAdministrator
(KiX Master Guru)
2007-01-27 01:42 PM
Re: Another login script: Error in Use Statement

place this:
? "USE L: " + $DriveToMap ? sleep 1
just before this line:
USE L: $DriveToMap

what it shows?


04nunhucks
(Getting the hang of it)
2007-01-27 01:46 PM
Re: Another login script: Error in Use Statement

Hi, Jooel, It shows the same error: error in USE statement on line 233
I added your piece of script to that line.

Also, a command line box appears and the only character in it is ")". The title bar of the box is wkix32.exe.


Benny69
(MM club member)
2007-01-27 02:27 PM
Re: Another login script: Error in Use Statement

Hi 04

The '.Caption' property is out dated and has been replaced with '.Text', You need to replace all of the '.Caption' properties with '.Text' in the entire script. (I count 30 occurrences)

Things to check on:
  • Access rights to the drive in question (can you map it manualy as the user you are running the script under)
  • KiXtart ver and KiXforms ver on the machine in question


04nunhucks
(Getting the hang of it)
2007-01-27 02:38 PM
Re: Another login script: Error in Use Statement

Hello Benny69,

I thought I had replaced all .cations with .text, but it does not seem so. Thanks for that.

I am an administrator and i can map to all the drives in the script.

The Version of KiXtart is 4.53 and KiXforms 2.46


Benny69
(MM club member)
2007-01-27 03:05 PM
Re: Another login script: Error in Use Statement

In your original post you said 'when trying to run the following script, the users recieve an error:', when i asked 'can you map it manualy as the user you are running the script under' you replied 'I am an administrator and i can map to all the drives in the script.' You can not map a drive as an administrator and expect the users to have the same access right as you, you have to try to map it as a user that is getting the error.

04nunhucks
(Getting the hang of it)
2007-01-27 03:37 PM
Re: Another login script: Error in Use Statement

Sorry, I did not read the posts properly. Using group policies, we allow the users to map the drives. The users are able to manualy map drives but we also need to ensure thay if they do map the drives manualy, they actually, map the drives that are assigned to their groups. All users need to be mapped to HomeDir, Sharesres, CDOMS, MFL etc.

The SIMSUsers need to map simsarea to their account as well. Each user gorup needs to have a certain share mapped to them.


Benny69
(MM club member)
2007-01-27 03:48 PM
Re: Another login script: Error in Use Statement

go to a machine that a user receives the error on, login as that user and run this single line script:
Code:
Use L: "\\sdc5400\mfl"

if the drive does not map then the user does not have rights to that directory on that server or the drive 'L:' is already being used.


04nunhucks
(Getting the hang of it)
2007-01-27 03:54 PM
Re: Another login script: Error in Use Statement

Hi, I have just tried that. The mapping was find and it mapped perfectly, however, here comes the worst part, if I try to login as admin, or any type of user, we all recieve the same error, and the script quits.

Benny69
(MM club member)
2007-01-27 03:58 PM
Re: Another login script: Error in Use Statement

if that is the case there is nothing wrong with the script, the problem lies with the network and security.

04nunhucks
(Getting the hang of it)
2007-01-27 03:59 PM
Re: Another login script: Error in Use Statement

I have tried the following to no avail:

Code:
;$DriveToMap = @HomeShr
	$lblTask.Text = $Blanker
    $lblTask.Text = "Home Directory"
	Use U: @HomeShr		
	DoProgress(2)	
	
	
	;$DriveToMap = "\\sdc5400\mfl"
	$lblTask.Text = "MFL"
	Use L: "\\sdc5400\mfl"	
	DoProgress(2)
	
	
	;$DriveToMap = "\\sdc5400\sharedres"
	$lblTask.Text = "Shared Resources"
	Use R: "\\sdc5400\sharedres"		
	DoProgress(2)
	
	
	;$DriveToMap = "\\sdc5400\pcapps"
	$lblTask.Text = "PC Apps"
	Use P: "\\sdc5400\pcapps"	
	DoProgress(2)
	
	
	;$DriveToMap = "\\sdc5400\cdroms"
	$lblTask.Text = "CD Roms"
	Use V: "\\sdc5400\cdroms"	
	DoProgress(2)
	
	
	IF INGROUP("SIMSUsers") 
	;$DriveToMap = @LServer + "\Simsarea"
	$lblTask.Text = "SIMS Area"
	Use W: @LServer + "\Simsarea"		
	DoProgress(2)

ENDIF	
	IF INGROUP("Staff")
	;$DriveToMap = "\\rdc5400\students"
	$lblTask.Text = "Students"
	Use S: "\\rdc5400\students"	
	DoProgress(2)

	
	;$DriveToMap = "\\sdc5400\shared"
	$lblTask.Text = "Shared"
	Use O: "\\sdc5400\shared"	
	DoProgress(2)

	ENDIF
	IF INGROUP("Domain Admins")
	;$DriveToMap = "\\rdc5400\NetAdmin"
	$lblTask.Text = "NetAdmin"
	Use N: $DriveToMap		
	DoProgress(2)

	
	;$DriveToMap = "\\rdc5400\Menus"
	$lblTask.Text = "Menus"
	Use M: "\\rdc5400\Menus"		
	DoProgress(2)

ENDIF
	EndFunction


Les
(KiX Master)
2007-01-27 03:59 PM
Re: Another login script: Error in Use Statement

You should delete a drive using the /persistent switch before remapping just in case there is a persistent static mapping already.

04nunhucks
(Getting the hang of it)
2007-01-27 04:03 PM
Re: Another login script: Error in Use Statement

Actually, I think I know what the problem is:

I am doing the testing remotely and the workstation I am at cannot find the server that I am mapping to. Does that make sense? Although that did not occur the last time the server had a BSoD and users were loggin on.


Benny69
(MM club member)
2007-01-27 04:03 PM
Re: Another login script: Error in Use Statement

Les makes a good point.
change these lines:
Code:
$DriveToMap = "\\sdc5400\mfl"
$lblTask.Text = $Blanker
$lblTask.Text = $DriveToMap
Use L: $DriveToMap ;** Map L: to SharedRes Share
DoProgress(5)

to:
Code:
$DriveToMap = "\\sdc5400\mfl"
$lblTask.Text = $Blanker
$lblTask.Text = $DriveToMap
Use L: /DEL /PERSISTENT
Use L: $DriveToMap ;** Map L: to SharedRes Share
DoProgress(5)


04nunhucks
(Getting the hang of it)
2007-01-27 04:10 PM
Re: Another login script: Error in Use Statement

But actually, that is notthe problem. I tried this at home:

Code:
Use L: "\\shamil-2dptm3ss\cache"
USE N: "\\shamil-2dptm3ss\netlogon"
Use V: "\\sdc5400\cdroms"


and that came up with no errors. Its wierd why it pounces on the second USE statement and not the first on the first script I posted.


04nunhucks
(Getting the hang of it)
2007-01-27 04:27 PM
Re: Another login script: Error in Use Statement

Thanks Les and Benny69 but /del /persisteant has no effect what so ever.

Benny69
(MM club member)
2007-01-27 04:30 PM
Re: Another login script: Error in Use Statement

then the prob must be with the network and or security.

04nunhucks
(Getting the hang of it)
2007-01-27 04:32 PM
Re: Another login script: Error in Use Statement

Ok, on Monday I will try on site and on a virtual network. I will report anything here.Thanks for the help.

Les
(KiX Master)
2007-01-27 04:41 PM
Re: Another login script: Error in Use Statement

Originally Posted By: 04nunhucks
Thanks Les and Benny69 but /del /persisteant has no effect what so ever.
It only works if you spell persistent correctly.


04nunhucks
(Getting the hang of it)
2007-01-27 04:54 PM
Re: Another login script: Error in Use Statement

Sorry about that, I did spell it right in the script. I write things quickly with many mistakes.

Anyway, I found a script like the one I am used in this topic. It does work and I have helf-found out the problem.

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

;**************************
;** Dim some global vars **
;**************************
Dim $frmForm
Dim $fraBanner, $fraForm 
;Dim $prgProgress 
Dim $Hour

;**************************
;** Set some global vars **
;**************************
$strVersion = "V.4.2.09"
$LSD = @LServer + "\netlogon"
$WaitTime = 1	;** Time to wait after each task
$Blanker = "             "	;** Blank texts  

;******************
;**  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 = 14
$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 = 8
$fraBanner.ForeColor = $frmForm.RGB(0,0,0)
$fraBanner.PrintXY (10,24,$strVersion +"   Powered by NetCare Engine (Shamil Nunhuck) ")
$fraBanner.FontSize = 9
$fraBanner.PrintXY (10,35,"@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(255,255,255)
$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.Top = 100
$lblJob.Width = 440 ;fraMain.Width - 20
$lblJob.Left = 10

$lblTask = $fraMain.Controls.Add("label")
$lblTask.FontSize = 10
$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 @fullname (@priv)"
Else 
	If $Hour < 17
		$Greeting = "Good Afternoon @fullname (@priv) "
	Else
		$Greeting = "Good Evening @fullname (@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(255,255,255)
$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()
MapDrives()
DoAudit()
LogUser()                                                        
DoAntiVirus()
Time()
Snd()

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

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

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

Function CheckDLL()
	;*************************************************
	;** Check that KIXFORMS.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								;** KixForms not registered
														;** Copy .DLL
		$SourceFile = @LServer + "\netlogon\kixforms.dll"
		$Value = ReadValue("HKLM\System\CurrentControlset\Control\Windows", "SystemDirectory") 
		$Destination = ExpandEnvironmentVars($Value) 
		Copy $SourceFile $Destination
														;** Register .DLL silently
		$CMDLine = "regsvr32 /s " + $Destination + "\kixforms.dll"
		$ObjShell = CreateObject("WScript.Shell")
		$ObjShell.run($CMDLine, 1, true)
														;** Kill shell object
		$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)

	
IF INGROUP("Staff")	
		
$DriveToMap = "\\rdc5400\students"
		$lblTask.Text = $DriveToMap
		USE W: $DriveToMap							;** Map W: to Students Share
		DoProgress(5)

		$DriveToMap = "\\sdc5400\shared"
		$lblTask.text = $DriveToMap
		USE O: $DriveToMap							;** Map O: to Old Work Area
		DoProgress(5)
End IF

IF INGROUP("Domain Admins")
	
    	$DriveToMap = "\\rdc5400\NetAdmin"
		$lblTask.text = $DriveToMap
		USE N: $DriveToMap							;** Map P: to pcapps Share
		DoProgress(5)
	    
		$DriveToMap = "\\rdc5400\Menus"
		$lblTask.text = $DriveToMap
		USE M: $DriveToMap							;** Map R: to sharedres Share
	    DoProgress(5)
End IF
		IF INGROUP("SIMSUsers")		
		
		$DriveToMap = @LServer + "\Simsarea"														
		$lblTask.text = $DriveToMap											
		USE S: $DriveToMap	
End IF	
	
	$DriveToMap = @HomeShr 
	$lblTask.text = $DriveToMap
	USE U: @HomeShr	;** Map U: to HomeDir Share
    DoProgress(5)

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

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

	$DriveToMap = "\\sdc5400\pcapps"
	$lblTask.text = $DriveToMap			
	USE P: $DriveToMap							;** Map T: to PcApps Share
DoProgress(5)

	$DriveToMap = "\\sdc5400\cdroms"
	$lblTask.text = $DriveToMap
	USE V: $DriveToMap							;** Map V: to CDRoms Share
	DoProgress(5)
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(20)
	
	$lblTask.Text = $Blanker
	$lblTask.Text = "Software"
	Sleep $WaitTime
	DoProgress(20)
EndFunction
Function LogUser()
	$lblJob.text = $Blanker
	$lblJob.text = "Collecting Logon Info... "
	DoProgress(10)
	
	;** Dim some vars
	$LogFolder = @LServer + "\netlogon\logs\"			
	
	;** Path to log dir
	$FileName = @MONTH + "--"+ "log.htm"		

	;** 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.text = $Blanker
		$lblTask.text = "Time and Date"
		Sleep $WaitTime
		DoProgress(10)
		
		;** User Details
		$Silent = WriteLine (1, "User: " + @USERID + " Full Name: " + @FULLNAME + $CRLF);Write data to file
		$lblTask.text = $Blanker
		$lblTask.text = "User Name"
		Sleep $WaitTime
		DoProgress(15)
		
		;** IP 0
		$Silent = WriteLine (1, "IP: " + @IPAddress0 + $CRLF)  
		$lblTask.text = $Blanker
		$lblTask.text = "IP Address"
		Sleep $WaitTime
		DoProgress(15)
		
		$Silent = WriteLine (1, $CRLF) 
										
		$Silent = Close (1)  ;Close file
	EndIf
	Sleep 0.5
EndFunction

Function DoAntiVirus()
	$lblJob.Text = $Blanker
	$lblJob.Text = "Updating Antivirus... "
	
	$lblTask.Text = $Blanker
	
	DoProgress(10)
EndFunction

Function Time()
	;======= Sync Time Local Time Server 
	$lblJob.Text = $Blanker
	$lblJob.Text = "Synchronizing time "
	$lblTask.Text = $Blanker
	$lblTask.Text = "Synchronizing with SWGfL NTP (Time) Server"
	DoProgress(25)
	If Exist (@LServer+"\netlogon\TimeSync.bat")
		Shell @LServer+"\netlogon\TimeSync.bat"
		
	EndIf
EndFunction

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

DoProgress(5)
EndFunction

Function ExitScript()
	Quit()
EndFunction

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



As you can see above, I have commented out
Code:
 $DriveToMap = "\\sdc5400\mfl"	
	;$lblTask.text = $DriveToMap
	;USE L: $DriveToMap						;** Map L: to SharedRes Share
	;DoProgress(5)


This was the offending part in the logon script. My next job is to find out why. Thanks for all your efforts.

btw, I foind this copy in an old (?) backup.


ShawnAdministrator
(KiX Supporter)
2007-01-27 05:19 PM
Re: Another login script: Error in Use Statement

ok, lets start by fixing-up a syntax error in your code:

line 235: you have END IF instead of ENDIF


04nunhucks
(Getting the hang of it)
2007-01-27 05:23 PM
Re: Another login script: Error in Use Statement

Ok, thanks, but I think this script has brought me back to square 1. It fails to map the drives and if I put the common mappings before the If in groups, I get the same error as before.

I have split the mappings in to spearate functions:

MapDrivesGroups
MapDrivesCommon

The problem is with the common mappings. I know there is no prolbem with either machine/network OR the script (USE L: $DriveToMap), so what can it be?


ShawnAdministrator
(KiX Supporter)
2007-01-27 05:29 PM
Re: Another login script: Error in Use Statement

Well lets be clear here. Based on the error you first indicated - your getting a syntax error, not a failure to map drive error. Syntax errors have nothing to do with you being an admin versus someone else.

04nunhucks
(Getting the hang of it)
2007-01-27 05:35 PM
Re: Another login script: Error in Use Statement

Yes. Syntax was the word I was looking for in my last post. But I somehow got sidetracked by something else. Can you find any syntax errors in the script?

ShawnAdministrator
(KiX Supporter)
2007-01-27 05:38 PM
Re: Another login script: Error in Use Statement

Kixtart can generate syntax errors in weird and wonderfull ways - missing quotes, parens mismatched block structures and other even harder to find things. All i'm saying is - fix the END IF thing, re-test and re-post and then we can move on to the next potential issue.

-Shawn


04nunhucks
(Getting the hang of it)
2007-01-27 06:07 PM
Re: Another login script: Error in Use Statement

Ok, I have fixed the END IF occurances:

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

;**************************
;** Dim some global vars **
;**************************
Dim $frmForm
Dim $fraBanner, $fraForm 
;Dim $prgProgress 
Dim $Hour

;**************************
;** Set some global vars **
;**************************
$strVersion = "V.4.2.09"
$LSD = @LServer + "\netlogon"
$WaitTime = 1			;** Time to wait after each task
$Blanker = "                                  "	;** Blank texts  

;******************
;**  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 = 14
$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 = 8
$fraBanner.ForeColor = $frmForm.RGB(0,0,0)
$fraBanner.PrintXY (10,24,$strVersion +"   Powered by NetCare Engine (Shamil Nunhuck) ")
$fraBanner.FontSize = 9
$fraBanner.PrintXY (10,35,"@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(255,255,255)
$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.Top = 100
$lblJob.Width = 440 ;fraMain.Width - 20
$lblJob.Left = 10

$lblTask = $fraMain.Controls.Add("label")
$lblTask.FontSize = 10
$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 @fullname (@priv)"
Else 
	If $Hour < 17
		$Greeting = "Good Afternoon @fullname (@priv) "
	Else
		$Greeting = "Good Evening @fullname (@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(255,255,255)
$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
MapDrivesGroups()
MapDrivesCommon()
DoAudit()
LogUser()                                                       
DoAntiVirus()
Time()
Snd()

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

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

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

Function CheckDLL()
	;*************************************************
	;** Check that KIXFORMS.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								;** KixForms not registered
														;** Copy .DLL
		$SourceFile = @LServer + "\netlogon\kixforms.dll"
		$Value = ReadValue("HKLM\System\CurrentControlset\Control\Windows", "SystemDirectory") 
		$Destination = ExpandEnvironmentVars($Value) 
		Copy $SourceFile $Destination
														;** Register .DLL silently
		$CMDLine = "regsvr32 /s " + $Destination + "\kixforms.dll"
		$ObjShell = CreateObject("WScript.Shell")
		$ObjShell.run($CMDLine, 1, true)
														;** Kill shell object
		$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 MapDrivesGroups()
	$lblJob.Text = $Blanker
	$lblJob.Text = "Mapping Network Drives... "
	
	;Use * /DELETE



	Sleep $WaitTime
	DoProgress(5)

	
IF INGROUP("Staff")	
		
$DriveToMap = "\\rdc5400\students"
		$lblTask.Text = $DriveToMap
		USE W: $DriveToMap							;** Map W: to Students Share
		DoProgress(5)

		$DriveToMap = "\\sdc5400\shared"
		$lblTask.text = $DriveToMap
		USE O: $DriveToMap							;** Map O: to Old Work Area
		DoProgress(5)
EndIF

IF INGROUP("Domain Admins")
	
    	$DriveToMap = "\\rdc5400\NetAdmin"
		$lblTask.text = $DriveToMap
		USE N: $DriveToMap							;** Map P: to pcapps Share
		DoProgress(5)
	    
		$DriveToMap = "\\rdc5400\Menus"
		$lblTask.text = $DriveToMap
		USE M: $DriveToMap							;** Map R: to sharedres Share
	    DoProgress(5)
EndIF
		IF INGROUP("SIMSUsers")		
		
		$DriveToMap = @LServer + "\Simsarea"														
		$lblTask.text = $DriveToMap											
		USE S: $DriveToMap	
EndIF	

EndFunction


Function MapDrivesCommon()
;******* Common Mappings- Everyone get these***********************	
	$DriveToMap = @HomeShr 
	$lblTask.text = $DriveToMap
	USE U: @HomeShr						    ;** Map U: to HomeDir Share
    DoProgress(5)

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

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

	$DriveToMap = "\\sdc5400\pcapps"
	$lblTask.text = $DriveToMap			
	USE P: $DriveToMap						;** Map T: to PcApps Share
DoProgress(5)

	$DriveToMap = "\\sdc5400\cdroms"
	$lblTask.text = $DriveToMap
	USE V: $DriveToMap					    ;** Map V: to CDRoms Share
	DoProgress(5)
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(20)
	
	$lblTask.Text = $Blanker
	$lblTask.Text = "Software"
	Sleep $WaitTime
	DoProgress(20)
EndFunction
Function LogUser()
	$lblJob.text = $Blanker
	$lblJob.text = "Collecting Logon Info... "
	DoProgress(10)
	
	;** Dim some vars
	$LogFolder = @LServer + "\netlogon\logs\"			
	
	;** Path to log dir
	$FileName = @MONTH + "--"+ "log.htm"		

	;** 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.text = $Blanker
		$lblTask.text = "Time and Date"
		Sleep $WaitTime
		DoProgress(10)
		
		;** User Details
		$Silent = WriteLine (1, "User: " + @USERID + " Full Name: " + @FULLNAME + $CRLF);Write data to file
		$lblTask.text = $Blanker
		$lblTask.text = "User Name"
		Sleep $WaitTime
		DoProgress(15)
		
		;** IP 0
		$Silent = WriteLine (1, "IP: " + @IPAddress0 + $CRLF)  
		$lblTask.text = $Blanker
		$lblTask.text = "IP Address"
		Sleep $WaitTime
		DoProgress(15)
		
		$Silent = WriteLine (1, $CRLF) 
										
		$Silent = Close (1)                             ;Close file
	EndIf
	Sleep 0.5
EndFunction

Function DoAntiVirus()
	$lblJob.Text = $Blanker
	$lblJob.Text = "Updating Antivirus... "
	
	$lblTask.Text = $Blanker
	
	DoProgress(10)
EndFunction

Function Time()
	;======= Sync Time Local Time Server 
	$lblJob.Text = $Blanker
	$lblJob.Text = "Synchronizing time "
	$lblTask.Text = $Blanker
	$lblTask.Text = "Synchronizing with SWGfL NTP (Time) Server"
	DoProgress(25)
	If Exist (@scriptdir+"TimeSync.bat")
		Shell @scriptdir+"TimeSync.bat"
		
	EndIf
EndFunction

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

DoProgress(5)
EndFunction

Function ExitScript()
	Quit()
EndFunction

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



ShawnAdministrator
(KiX Supporter)
2007-01-27 06:23 PM
Re: Another login script: Error in Use Statement

So I assume your getting the exact same error on the exact same line ?

-Shawn


04nunhucks
(Getting the hang of it)
2007-01-27 06:31 PM
Re: Another login script: Error in Use Statement

It is the exact same error but on a different line. However, the same code is on this line. This does not make any sense of why there is a USE error?

ShawnAdministrator
(KiX Supporter)
2007-01-27 07:15 PM
Re: Another login script: Error in Use Statement

What happens if you comment-out this line (a few lines before):

USE U: @HomeShr


Les
(KiX Master)
2007-01-27 07:16 PM
Re: Another login script: Error in Use Statement

I see in the script:
USE U: @HomeShr

You are mixing technologies. If you are defining @HomeShr in the users' profile, you should not try to do it in the script. Remove it from the profile and build out the path instead.


04nunhucks
(Getting the hang of it)
2007-01-27 07:36 PM
Re: Another login script: Error in Use Statement

Aha, it seems to work now. Thank you. It is very much appreciated.

Glenn BarnasAdministrator
(KiX Supporter)
2007-01-27 07:42 PM
Re: Another login script: Error in Use Statement

Are you defining SHARE permissions? (or has someone else defined them?)

In an AD/Domain environment, the share should be Authenticated Users / Full Control, and actual permissions assigned from the NTFS level. This assumes you have no Wintendo clients or workgroups, which might rely on share perms.

Combining NTFS and Share permissions is a black art, that, practiced indiscriminately will lead to the most bizzare results.

BTW - on 2K3 systems, only Admins have FC perms, and Everyone has Read perms on shares. You MUST change the share perms if you expect any non-admins to actually be able to write to shares.

Just something else to check...

Also, many of your comments seem to come AFTER the code they describe - just seems odd..

Finally, declaring vars is not $X=4, but "DIM $X". A suggestion for code that will be supported by others, or will become complex and difficult to remember what you did in 6 months is to declare vars 1 per line, and add a comment to describe what it is for. Temp vars can be clumped together, sorta like this:
Code:
Dim $IFile      ; Input file name
Dim $OFile      ; Output file name
Dim $I,$J,$K    ; index pointers for loops/arrays
Dim $           ; var to catch and ignore result codes


Glenn


04nunhucks
(Getting the hang of it)
2007-01-27 08:02 PM
Re: Another login script: Error in Use Statement

Hi Glenn, thanks for telling me that. I did not actually know what the previous technician did but I can kinda guess. I will definately write in comments. It will make life a lot easier

I would like to say thank you to the KiXtart community for helping me to resolve the issue.