thanks

code:
;;;;;;;adding debug menu for admin or support accounts ;;;;;;;;;;
;
if ingroup ("main admin grp") or ingroup ("support accounts");
$debug=1;
else ;
$debug=0;
endif;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


$TRUE = 1
$FALSE = 0
If $Debug=1
$DebugFlag = 1
Else
$DebugFlag = 0
EndIf
$DebugLevel = "Info"

;========================================================
;
; sending Email to admin account
;
$AdminEmail = "";
$MailServer = "";
;
;========================================================


;========================================================
;
; main server name
;
;$Lserver = "server-ip-address";
$LServer = "server-name"
;
;=======================================================

;========================================================
;
; File locations
;
$LoggingLocation="\\server-name\log$";
; log location
;


$FileLocation="\\server-name\news$"


; news file
;========================================================



Break Off

;Default Settings
$os=""
$os_type=""
$os_service_pack=""
$progressstep=3
$sleeptime=0
$numerrors=0
Global $time

Global $UpdateSoftware[0]
$Updates=0
$RunUpdates=$False

$tmpdir=ExpandEnvironmentVars("%tmp%")
$systemdrive=ExpandEnvironmentVars("%systemdrive%")
$windir=ExpandEnvironmentVars("%windir%")
$comspec=ExpandEnvironmentVars("%comspec%")


If Exist($systemdrive + "/program files/utils/kixtart") or
$KixDir=$systemdrive + "/program files/utils/kixtart"
Else
$KixDir=@LDrive
$KixDir="."
EndIf

Global $DebugMessages[0]
$NumMessages=0
$DebugMessages[$NumMessages]="-BEGIN--------------------------"

;================================================================
;
;
; Main Application
;
; Draw Form
DrawForms();
;
; Get OperatingSystemInformation Selects operating system
OperatingSystem() ;
$OSBox.Text=SubStr($os,1,22);

;
; Show News
ShowNews(); load news.txt file from
; Syncing Time
SyncTime();
;
;
; Connecting Drives
ConnectDrives();
;
;
; Install Printers
Installprinters()
;
;
; Set machine to stanard Settings
ExtraSettings();

;
; Write Log File
WriteLogFile();
;
;
; Fill Progressbar
While $ProgressBar.Value < 100;
Progress("Finalizing",20);
;
Loop;
;
Exit 1;
;================================================================


;***********************************************************************
;**
;** Update the clock
;**
Function UpdateClock()
If @Time<>$time
$Clock.Text=@Time
$time=@time
EndIf
EndFunction

;***********************************************************************
;**
;** Retrieve News File
;**
Function ShowNews()
$NewsRadioButton.Value=1
Progress( "Retrieving News")
If Open(1, $FileLocation + "\News.txt") = 0
$NewsLine = ReadLine(1)
While @ERROR=0
$NewsTextBox.Text=$NewsTextBox.Text + $NewsLine + Chr(13) + Chr(10)
$NewsLine = ReadLine(1)
Loop
If Close (1) <> 0
DbgMessage("Error","News File could not be closed", @SError)
EndIf
Else
DbgMessage("Debug","No News")
EndIf
$NewsRadioButton.Value=0
$NewsRadioButton.Enabled =0
EndFunction

;***********************************************************************
;**
;** Syncronize the local system time with the logon server. The PDC
;** server server-name syncronizes with NTP server
;**
Function SyncTime()
$TimeRadioButton.Value=1
DBGMessage ("Info", "Syncing Time:" )
Progress( "Syncing Time")
;If $NT_Mode="yes"
SetTime "\\server-name"; + $Lserver
If @ERROR<>0
DBGMessage ("Error", " - Error Finding Time Server : " + $Lserver )
Else
DbgMessage("Info"," - Synchronized time with : " + $Lserver)
;EndIf
;EndIf
$TimeRadioButton.Value=0
$TimeRadioButton.Enabled =0
EndFunction

;***********************************************************************
;**

;***********************************************************************


;** Connect Shares to Drives
;**
Function ConnectDrives()
$SharesRadioButton.Value=1
Progress( "Connecting Drives")
DbgMessage("Info","Connecting Home drive Drives:")
ConnectHomeDrive()

$SharesRadioButton.Value=0
$SharesRadioButton.Enabled =0

DbgMessage("Info","Connecting location drive")
COnnectlocationDrives()

DbgMessage("Info","Connecting default Drives:")
ConnectDefaultDrives()

DbgMessage("Info","Connecting group Drives:")
COnnectGroupDrives()

DbgMessage("Info","Connecting department Drives:")
COnnectdeptartmentDrives()


EndFunction

;***********************************************************************
;**
;** Connect Home Drive
;**
Function ConnectHomeDrive()
;******************************
; Home DriveShares
;******************************
Progress( "Connecting n:")



DbgMessage("Info","home folder - n: = " + @userid)

;Use n: /delete /persistent

Use n: "\\" + $lserver + "\" @userid + "$$"


If @ERROR = 1
DBGMessage ("HOMESHR","No Home Share available " + $lserver)
Else
DbgMessage ("Info","Home Share Connected " + @userid)

Return

EndIf
EndFunction

;***********************************************************************
;**
;****************************************
;** Connect DefaultShares to Drives *
;****************************************

Function ConnectDefaultDrives()

$mappingRadioButton.Value=1

use j: "\\server-name\apps$"
DbgMessage("Info","Default drives success")

Progress( "Connecting Application Drives:")

$mappingRadioButton.Value=0
$mappingRadioButton.Enabled =0

EndFunction


;***********************************************************************
;**
;****************************************
;** Connect location to Drives *
;****************************************

Function ConnectlocationDrives()

Progress( "Connecting l:")

$locationRadioButton.Value=1

$location = substr(@wksta, 1,7)

DbgMessage("Info","location - l: = " + $location)

Use; l: /delete

Use l: "\\server-name\$location"+"$"
If @ERROR = 1
DBGMessage ("location","No location Share available " + $lserver)
Else
DbgMessage ("Info","location Share Connected " + $location+"$")


EndIf

$locationRadioButton.Value=0
$locationRadioButton.Enabled=0
EndFunction


;***********************************************************************
;**
;****************************************
;** Connect GroupGroupDrives to Drives *
;****************************************

Function COnnectGroupDrives()

CALL "\\server-name\NETLOGON\main-group-drives.KIX"

Progress( "Connecting Group Drives:")

DbgMessage ("Info","Connecting group drive success ")

EndFunction


;*************************************************************************
;***********************************************************************

;**
;****************************************
;** Connect Deptartment Drives *
;****************************************

Function COnnectdeptartmentDrives()

CALL "\\server-name\NETLOGON\deptartment-Drives.kix"

Progress( "Connecting Department Drives")

DbgMessage ("Info","Connecting Department Drives success ")

endfunction
;***********************************************************************
;***********************************************************************


;**** printer setup ****
;
Function Installprinters()

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if @inwin=1 ;>>>>>>>>>>>>> this is displaying a error code to be removed <<<<<<<<<<<<
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
$debug_mode="no"

;CALL "\\server-name\NETLOGON\printers.kix"
$rc=DbgMessage ("Info","printers")

endif


EndFunction
;***********************************************************************

;************************************************************************
;**
;** Set Extra setting
;**
Function ExtraSettings()
$ExtraSettingsRadioButton.Value=1
Progress( "Setting Extra Settings")

DbgMessage("Info","Setting Extra settings:")

CALL "\\server-name\NETLOGON\extra.kix"


$ExtraSettingsRadioButton.Value=0
$ExtraSettingsRadioButton.Enabled=0
EndFunction
;************************************************************************
;
;************************************************************************
;**
;** Used to send email to the NT Administrator defined in $AdminEmail.
;** Attaches a copy of the local $DebugFile to the message so we can see
;** if there's a history of problems on the machine.
;**
;** Interprets the user's email address from their logon name. Both
;** logon names as well as email addresses are based on the employee's
;** insurance (employee) number.
;**
Function SendAdminMail()
If Len(DebugMessages)>1
Progress( "Sending Debug Report")
$UserEmail = @USERID + "@@" + $MailServer
; REM Run "POSTIE.exe -host:$MailServer -to:$AdminEmail -from:$UserEmail

-s:Logon_Script_Error_on_@WKSTA -msg:" + Chr(34) + "$DebugMessages"
EndIf
EndFunction

;************************************************************

;***********************************************************************
;**
;** Update Progress Bar
;**
Function Progress($ProgressText,optional $Step)
If $Step=""
$Step=$progressstep
EndIf
$ProgressTextBox.Text=$ProgressText
If $ProgressBar.Value + $Step < 101
$ProgressBar.Value=$ProgressBar.Value+$Step
If $DebugFlag = $TRUE
Sleep $sleeptime
EndIf
Else
$ProgressBar.Value=100
EndIf
$=Execute($Form.DoEvents())
EndFunction

;************************************************************
;** Function: DBGMessage
;** Usage: DBGMessage( "Debug", "This is a debug Message" )
;** DebugType : Info, Debug, Error
;**
Function DBGMessage($DebugType, $DebugMessage, Optional $SError)
Select
Case $DebugLevel="Error"
If $DebugType="Info" OR $DebugType="Debug"
Return
EndIf
Case $DebugLevel="Info"
If $DebugType="Debug"
Return
EndIf
EndSelect

If $DebugType="Error"
$numerrors=$numerrors+1
EndIf
$NumMessages=$NumMessages + 1
ReDim Preserve $DebugMessages[$NumMessages]

$DebugTime="" + @Date + " - " + @Time +" >"
$DebugText=$DebugType + " : " + $DebugMessage
If $SError<>""
$DebugText=$DebugText + " Additional Info: @SERROR"
EndIf

$DebugMessages[$NumMessages]=$DebugTime + $DebugText
If $DebugFlag = $TRUE
$DbgTextBox.Text=$DbgTextBox.Text + $DebugText + @CRLF
Sleep $sleeptime
EndIf
EndFunction

;************************************************************
;** Function: WriteLogfile
;** Usage: WriteLogFIle()
;**
Function WriteLogFile()
; Display DebugMessage
$WriteLogFileRadioButton.Value=1
Progress( "Writing Logfile")
$LogFile=$LoggingLocation + "\" + @Wksta + ".log"
If Exist($LogFile)
If GetFileSize($LogFile) > 1024 * 1024
Del($LogFile)
EndIf
EndIf

$NumMessages=$NumMessages + 1
ReDim PRESERVE $DebugMessages[$NumMessages]
$DebugMessages[$NumMessages]="-END----------------------------"

If Open(1, $LogFile,5) = 0
For $x=0 to $NumMessages
If WriteLine(1, $DebugMessages[$x] + @CRLF)<>0
DbgMessage("Error","DebugLine could not be written")
EndIf
Next
If Close(1)<>0
DbgMessage("Error","Log File could not be closed")
EndIf
Else
DbgMessage("Debug","Log file could not be written")
EndIf
$WriteLogFileRadioButton.Value=0
$WriteLogFileRadioButton.Enabled =0
EndFunction

;***********************************************************************
;**
;** calculates OS version with service pack
;**
Function OperatingSystem()
DbgMessage("Info","Checking Operating System")
Progress("Checking Operating System")

If (@inwin = 1)
$NT_mode="yes"
Else
$NT_mode="no"
EndIf

$os=""
$os_dos=@dos


$os_product=ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductType")


$os_productSuite=ReadValue("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ProductOptions","ProductSuit

e")
$os_service_pack=""


$os_subversion=ReadValue("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion","SubVersionNumber")
Select
Case ($NT_mode = "yes") AND ($os_product <> "WinNT") AND ($os_dos = "5.1") AND

(InStr($os_productSuite,"Terminal Server") <> 0)
$os="XP_Terminal_Server"
Case ($NT_mode = "yes") AND ($os_product <> "WinNT") AND ($os_dos = "5.1") ; - Windows XP

Server
$os="XP_Server"
Case ($NT_mode = "yes") AND ($os_product = "WinNT") AND ($os_dos = "5.1") ; - Windows XP

Professional
$os="XP_Professional"
Case ($NT_mode = "yes") AND ($os_product <> "WinNT") AND ($os_dos = "5.0") AND

(InStr($os_productSuite,"Terminal Server") <> 0)
$os="W2K_Terminal_Server"
Case ($NT_mode = "yes") AND ($os_product <> "WinNT") AND ($os_dos = "5.0") ; - Windows 2000

-
$os="W2K_Server"
Case ($NT_mode = "yes") AND ($os_product = "WinNT") AND ($os_dos = "5.0")
$os="W2K_Professional"
Case ($NT_mode = "yes") AND ($os_product = "LANMANNT") ; - Windows NT -
$os="NT4_Domain_Controller"
Case ($NT_mode = "yes") AND ($os_product = "ServerNT") AND (InStr($os_productSuite,"Terminal

Server") <> 0)
$os="NT4_Terminal_Server"
Case ($NT_mode = "yes") AND ($os_product = "ServerNT")
$os="NT4_Member_Server"
Case ($NT_mode = "yes") AND ($os_product = "WinNT")
$os="NT4"
Case ($NT_mode <> "yes") AND (@dos = "4.90")
$os="ME"
Case ($NT_mode <> "yes") AND ($os_dos = "4.10") AND (InStr(Lcase($os_subversion),"c") <> 0)

; - Windows 98 -
$os="W98c"
Case ($NT_mode <> "yes") AND ($os_dos = "4.10") AND (InStr(Lcase($os_subversion),"b") <> 0)
$os="W98b"
Case ($NT_mode <> "yes") AND ($os_dos = "4.10") AND (InStr(Lcase($os_subversion),"a") <> 0)
$os="W98a"
Case ($NT_mode <> "yes") AND ($os_dos = "4.10")
$os="W98"
Case ($NT_mode <> "yes") AND ($os_dos = "4.0") AND (InStr(Lcase($os_subversion),"c") <> 0) ;

- Windows 95 -
$os="W95c"
Case ($NT_mode <> "yes") AND ($os_dos = "4.0") AND (InStr(Lcase($os_subversion),"b") <> 0)
$os="W95b"
Case ($NT_mode <> "yes") AND ($os_dos = "4.0") AND (InStr(Lcase($os_subversion),"a") <> 0)
$os="W95a"
Case ($NT_mode <> "yes") AND ($os_dos = "4.0")
$os="W95"
Case 1
$os="???" ; - undetermined -
EndSelect
;
$os_service_pack=""
Select
Case ($NT_mode = "yes") AND ($os_dos = "5.1") ; - Windows XP
$os_service_pack=ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows

NT\CurrentVersion","BuildLab")
If (Len($os_service_pack) <> 0)
$os=SubStr($os,1,3)+"_"+Ltrim(Rtrim($os_service_pack))
$os_service_pack=Ltrim(Rtrim($os_service_pack))
EndIf
Case ($NT_mode = "yes") AND ($os_dos <> "5.1") ; Windows NT4 + W2K
$os_service_pack=ReadValue("HKEY_LOCAL_MACHINE\Software\Microsoft\Windows

NT\CurrentVersion","CSDVersion")
If (Len($os_service_pack) <> 0)
$os=SubStr($os,1,3)+"_"+SubStr($os_service_pack,Len($os_service_pack),1)
$os_service_pack=Ltrim(Rtrim($os_service_pack))
EndIf
Case 1
; Windows 95, 98 + ME
EndSelect
;
$os_type=""
$os_dos=@dos
Select
Case ($NT_mode = "yes") AND ($os_dos = "5.1") ; - Windows XP -
$os_type="XP"
Case ($NT_mode = "yes") AND ($os_dos = "5.0") ; - Windows 2000 -
$os_type="W2K"
Case ($NT_mode = "yes") ; - Windows NT -
$os_type="NT4"
Case ($NT_mode <> "yes") AND ($os_dos = "4.90") ; - Windows ME -
$os_type="ME"
Case ($NT_mode <> "yes") AND ($os_dos = "4.10") ; - Windows 98 -
$os_type="W98"
Case ($NT_mode <> "yes") AND ($os_dos = "4.0") ; - Windows 95 -
$os_type="W95"
Case 1
$os_type="???" ; - undetermined -
EndSelect
DbgMessage("Info","$os")
$os_type=Ltrim(Rtrim(SubStr($os_type+" ",1,3)))
EndFunction

;***********************************************************************
;**
;** DrawForms()
;**
Function DrawForms()

; Form
$Form = CreateObject("Kixtart.Form")
$Form.Caption = "Stmsite Login Script"
$Form.Width = 500
$Form.Height = 400
If $DebugFlag=$True
$Form.Left=(1024 / 2) - (500 / 2)
$Form.Top=(768 / 2) - (400 /2 )
Else
$Form.Center
EndIf
; ClockTimer
$Timer = $Form.Timer(600,0,0,15,15)
$Timer.OnTimer = "UpdateClock()"

; Logo
$Logo=$Form.PictureBox
$Logo.Left=5
$Logo.Top=5
$Logo.Width=483
$Logo.Height=50
$Logo.Picture="\\server-name\netlogon\logo.bmp"

; Info Frame
$InfoFrame = $Form.Frame("Information",5,55,240,140)

$OSLbl = $InfoFrame.Label("Os", 5, 15, 115, 15)
$OSBox = $InfoFrame.TextBox("", 120, 15, 115, 15)
$OSBox.BackColor=$Form.BackColor
$OSBox.Enabled=0
$UserIdLbl = $InfoFrame.Label("UserId", 5, 30, 115, 15)
$UserIdBox = $InfoFrame.TextBox(@USERID , 120, 30, 115, 15)
$UserIdBox.BackColor=$Form.BackColor
$UserIdBox.Enabled=0
$FullNameLbl = $InfoFrame.Label("Full Name", 5, 45, 115, 15)
$FullNameBox = $InfoFrame.TextBox(@FULLNAME, 120, 45, 115, 15)
$FullNameBox.BackColor=$Form.BackColor
$FullNameBox.Enabled=0
$PriviledgeLbl = $InfoFrame.Label("Priviledge", 5, 60, 115, 15)
$PriviledgeBox = $InfoFrame.TextBox(@WKSTA, 120, 60, 115, 15)
$PriviledgeBox.BackColor=$Form.BackColor
$PriviledgeBox.Enabled=0
$WorkStnLbl = $InfoFrame.Label("Workstation", 5, 75, 115, 15)
$WorkStnBox = $InfoFrame.TextBox(@WKSTA, 120, 75, 115, 15)
$WorkStnBox.BackColor=$Form.BackColor
$WorkStnBox.Enabled=0
$DomainLbl = $InfoFrame.Label("Domain", 5, 90, 115, 15)
$DomainBox = $InfoFrame.TextBox(@DOMAIN, 120, 90, 115, 15)
$DomainBox.BackColor=$Form.BackColor
$DomainBox.Enabled=0
$ServerLbl = $InfoFrame.Label("Server", 5, 105, 115, 15)
$ServerBox = $InfoFrame.TextBox($LSERVER, 120, 105, 115, 15)
$ServerBox.BackColor=$Form.BackColor
$ServerBox.Enabled=0
$MemberLbl = $InfoFrame.Label("Group Member", 5, 120, 115, 15)
$MemberBox = $InfoFrame.TextBox(@ingroup, 120, 120, 115, 15)
$MemberBox.BackColor=$Form.BackColor
$MemberBox.Enabled=0

; Action Frame
$ActionFrame = $Form.Frame("Actions",250,55,240,140)

$NewsRadioButton = $ActionFrame.RadioButton("Get News", 5, 15, 230, 15)
$TimeRadioButton = $ActionFrame.RadioButton("Set Time", 5, 30, 230, 15)
$SharesRadioButton = $ActionFrame.RadioButton("Connect Drives", 5, 45, 230, 15)
$mappingRadioButton = $ActionFrame.RadioButton("Mapping Default Drives", 5, 60, 230, 15)
$locationRadioButton = $ActionFrame.RadioButton("Setting Location", 5, 75, 230, 15)
$printerRadioButton = $ActionFrame.RadioButton("Setting Printers", 5, 90, 230, 15)
$ExtraSettingsRadioButton = $ActionFrame.RadioButton("Extra Settings", 5, 105, 230, 15)
$WriteLogFileRadioButton = $ActionFrame.RadioButton("Write Logfile", 5, 120, 230, 15)

; Logging Frame
$NewsFrame = $Form.Frame("News",5,195,485,150)

$NewsTextBox = $NewsFrame.TextBox("",5,15,475,130)
$NewsTextBox.BackColor = $Form.BackColor
$NewsTextBox.MultiLine=1
$NewsTextBox.Enable=0
$NewsTextBox.Text=""
$NewsTextBox.ScrollBars=2
$NewsTextBox.Wordwrap=1

; Progress Bar
$ProgressTextBox= $Form.TextBox
$ProgressTextBox.Left=5
$ProgressTextBox.Top=350
$ProgressTextBox.Width=200
$ProgressTextBox.Height=20
$ProgressTextBox.Enable=0
$ProgressTextBox.BackColor = $Form.BackColor

$ProgressBar = $Form.ProgressBar
$ProgressBar.Left=210
$ProgressBar.Top=350
$ProgressBar.Width=220
$ProgressBar.Height=20
$ProgressBar.Style = 1

; Clock
$CurrentTime=@Time
$Clock = $Form.TextBox("",435,350,55,20)
$Clock.Alignment=2
$Clock.Enabled=0
$Clock.BackColor=$Form.BackColor

$Form.Show
; DebugForm
If $DebugFlag=$True
$DbgForm = CreateObject("Kixtart.Form")
$DbgForm.Caption = "DebugBox"
$DbgForm.Width = 260
$DbgForm.Height = 500
$DbgForm.Left=1024 -260
$DbgFOrm.Top=768 - 550

$DbgTextBox=$DbgForm.TextBox()
$DbgTextBox.Left=5
$DbgTextBox.Top=5
$DbgTextBox.Width=245
$DbgTextBox.Height=465
$DbgTextBox.MultiLine=1
$DbgTextBox.Enable=0
$DbgTextBox.Text=""
$DbgTextBox.ScrollBars=2
$DbgTextBox.Wordwrap=1

$CurrentX=0
$CurrentY=0
$DbgForm.Show
EndIf

EndFunction