#173295 - 2007-01-27 02:38 PM
Re: Another login script: Error in Use Statement
[Re: Benny69]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
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
|
Top
|
|
|
|
#173296 - 2007-01-27 03:05 PM
Re: Another login script: Error in Use Statement
[Re: 04nunhucks]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
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.
|
Top
|
|
|
|
#173297 - 2007-01-27 03:37 PM
Re: Another login script: Error in Use Statement
[Re: Benny69]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
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.
|
Top
|
|
|
|
#173298 - 2007-01-27 03:48 PM
Re: Another login script: Error in Use Statement
[Re: 04nunhucks]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
go to a machine that a user receives the error on, login as that user and run this single line script:
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.
|
Top
|
|
|
|
#173299 - 2007-01-27 03:54 PM
Re: Another login script: Error in Use Statement
[Re: Benny69]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
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.
|
Top
|
|
|
|
#173300 - 2007-01-27 03:58 PM
Re: Another login script: Error in Use Statement
[Re: 04nunhucks]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
if that is the case there is nothing wrong with the script, the problem lies with the network and security.
|
Top
|
|
|
|
#173301 - 2007-01-27 03:59 PM
Re: Another login script: Error in Use Statement
[Re: 04nunhucks]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
I have tried the following to no avail:
;$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
|
Top
|
|
|
|
#173303 - 2007-01-27 04:03 PM
Re: Another login script: Error in Use Statement
[Re: 04nunhucks]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
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.
|
Top
|
|
|
|
#173304 - 2007-01-27 04:03 PM
Re: Another login script: Error in Use Statement
[Re: Les]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Les makes a good point. change these lines:
$DriveToMap = "\\sdc5400\mfl"
$lblTask.Text = $Blanker
$lblTask.Text = $DriveToMap
Use L: $DriveToMap ;** Map L: to SharedRes Share
DoProgress(5)
to:
$DriveToMap = "\\sdc5400\mfl"
$lblTask.Text = $Blanker
$lblTask.Text = $DriveToMap
Use L: /DEL /PERSISTENT
Use L: $DriveToMap ;** Map L: to SharedRes Share
DoProgress(5)
|
Top
|
|
|
|
#173305 - 2007-01-27 04:10 PM
Re: Another login script: Error in Use Statement
[Re: 04nunhucks]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
But actually, that is notthe problem. I tried this at home:
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.
|
Top
|
|
|
|
#173306 - 2007-01-27 04:27 PM
Re: Another login script: Error in Use Statement
[Re: 04nunhucks]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
Thanks Les and Benny69 but /del /persisteant has no effect what so ever.
|
Top
|
|
|
|
#173307 - 2007-01-27 04:30 PM
Re: Another login script: Error in Use Statement
[Re: 04nunhucks]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
then the prob must be with the network and or security.
|
Top
|
|
|
|
#173308 - 2007-01-27 04:32 PM
Re: Another login script: Error in Use Statement
[Re: Benny69]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
Ok, on Monday I will try on site and on a virtual network. I will report anything here.Thanks for the help.
|
Top
|
|
|
|
#173310 - 2007-01-27 04:54 PM
Re: Another login script: Error in Use Statement
[Re: Les]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
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.
;************************************************************
;************************************************************
;** **
;** 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 $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.
Edited by 04nunhucks (2007-01-27 04:58 PM)
|
Top
|
|
|
|
#173312 - 2007-01-27 05:23 PM
Re: Another login script: Error in Use Statement
[Re: Shawn]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
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?
|
Top
|
|
|
|
#173314 - 2007-01-27 05:35 PM
Re: Another login script: Error in Use Statement
[Re: Shawn]
|
04nunhucks
Getting the hang of it
Registered: 2006-09-08
Posts: 66
|
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?
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 466 anonymous users online.
|
|
|