here is the complete code
Code:
$TRUE 		= 1
$FALSE = 0
If $Debug=1
$DebugFlag = 1
Else
$DebugFlag = 0
EndIf
$DebugLevel = "Info" ; Info, Debug, Error

$AdminEmail = "??@??.nl" ; Where to send all of the warning messages
$MailServer = "172.27.1.8"

$Lserver = homesrvr
;$LServer = "homesrvr"
$LoggingLocation="\\homesrvr\logging$"
$FileLocation="\\homesrvr\netlogon"
;$FileLocation=@LDRIVE + ""
;$FileLocation="."

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

;Break Off
Break On

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

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

;Main Application

; Draw Form
DrawForms()
; Get OperatingSystemInformation
OperatingSystem()
$OSBox.Text=SubStr($os,1,22)
; Show News
ShowNews()
; Syncing Time
SyncTime()

; Connecting Drives
ConnectDrives()

; Set machine to stanard Settings
StandardSettings()

; Write Log File
WriteLogFile()

; Fill Progressbar
While $ProgressBar.Value < 100
Progress("Klaar met uitvoeren van script",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( "Ontvangen van nieuws")
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","Nieuws bestand kon niet worden gevonden", @SError)
EndIf
Else
DbgMessage("Debug","Geen Nieuws")
EndIf
$NewsRadioButton.Value=0
$NewsRadioButton.Enabled =0
EndFunction

;***********************************************************************
;**
;** Syncronize the local system time with the logon server. The PDC
;** server syncronizes with NTP server
;**
Function SyncTime()
$TimeRadioButton.Value=1
DBGMessage ("Info", "Synchroniseren van de Tijd:" )
Progress( "Sync Tijd")
If $NT_Mode="yes"
SetTime "\\" + $Lserver
If @ERROR<>0
DBGMessage ("Error", " - Fout bij het zoeken van de Tijd Server : " + $Lserver )
Else
DbgMessage("Info"," - Tijd gesynchroniseerd met : " + $Lserver)
EndIf
EndIf
$TimeRadioButton.Value=0
$TimeRadioButton.Enabled =0
EndFunction

;***********************************************************************
;**
;** Connect Shares to Drives
;**
Function ConnectDrives()
$SharesRadioButton.Value=1
Progress( "Verbinden met shares")
DbgMessage("Info","Verbinden van Shares:")
ConnectHomeDrive()
ConnectDefaultDrives()
ConnectGroupDrives()
$SharesRadioButton.Value=0
$SharesRadioButton.Enabled =0
EndFunction

;***********************************************************************
;**
;** Connect Home Drive
;**
Function ConnectHomeDrive()
;******************************
; Home DriveShares
;******************************
Progress( "Verbinden met L:")
DbgMessage("Info"," - L: = " + @HOMESHR)

Use L: /delete
If ($NT_mode = "no")
DelKey("HKEY_CURRENT_USER\Network\Persistent\H")
EndIf
Use L: "\\homesrvr\@USERID$$"
If @ERROR = 0
DbgMessage ("Info","Verbonden Persoonlijke Drive")
Else
DBGMessage ("HOMESHR","Persoonlijke Drive niet beschikbaar")
Return
EndIf
EndFunction

;***********************************************************************
;**
;** Connect DefaultShares to Drives
;**
Function ConnectDefaultDrives()
;******************************
; Default DriveShares
;******************************
If Exist($FileLocation + "\shares.ini")
For $x = 1 to 10
$DriveDefinition = ReadProfileString($FileLocation + "\shares.ini", "ALG", "drive" + $x)
If @ERROR = 0
If $DriveDefinition<>""
ConnectShare($DriveDefinition)
EndIf
Else
Return
EndIf
Next
EndIf
EndFunction

;***********************************************************************
;**
;** Connect GroupShares to Drives
;**
Function ConnectGroupDrives()
;******************************
; GroupShares
;******************************
If Exist($FileLocation + "\shares.ini")
If $group<>""
For $x = 1 to 10
$DriveDefinition = ReadProfileString($FileLocation + "\shares.ini", $group, "drive" + $x)
If @ERROR = 0
If $DriveDefinition<>""
ConnectShare($DriveDefinition)
EndIf
Else
Return
EndIf
Next
EndIf
EndIfEndFunction

;************************************************************************
;**
;** Set machine to default settings
;**
Function StandardSettings()
$StandardSettingsRadioButton.Value=1
Progress( "Standaard settings instellen")
DbgMessage("Info","Instellen van standaard instellingen:")
DisablePWDCaching()
; ScreenSaver
; Auto Logoff MfgPro Gui Client

$StandardSettingsRadioButton.Value=0
$StandardSettingsRadioButton.Enabled=0
EndFunction
;************************************************************************
;************************************************************************
;**
;** Disable Password Caching on Win9x machines
;** Password only has to be set for Network not for local machine anymore
;**
Function DisablePWDCaching()
DbgMessage("Info","Disable Password Caching Win9x")

If (($OS = "Win95") OR ($OS = "Win98"))
Progress( "Disable Password Caching")
ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK")
If @ERROR = 0
ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK")
If @ERROR = 0
WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK", "DisablePwdCaching","1","REG_SZ")
Else
EndIf
Else
ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES")
If @ERROR = 0
ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK")
If @ERROR = 0
ExistKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK")
If @ERROR = 0
WriteValue("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK", "DisablePwdCaching","1","REG_SZ")
Else
EndIf
Else
AddKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES\NETWORK")
EndIf
Else
AddKey("HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\POLICIES")
EndIf
EndIf
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( "Verzenden van debug repport")
$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

;************************************************************
;** Function: ConnectShare
;** Usage: ConnectShare ("L:, \\homesrvr\LOG_Procurement$, Logistics Procurement")
;**
Function ConnectShare( $DriveDefinition)
$DriveLetter=SubStr($DriveDefinition,1,InStr($DriveDefinition,",")-1)
$DriveDefinition=Ltrim(Rtrim(SubStr($DriveDefinition,InStr($DriveDefinition,",")+1)))
$Share=Ltrim(Rtrim(SubStr($DriveDefinition,1,InStr($DriveDefinition,",")-1)))
$ShareDesc=Ltrim(Rtrim(SubStr($DriveDefinition,InStr($DriveDefinition,",")+1)))
DbgMessage("Info"," - Disconnecting " + $DriveLetter + " on " + $Share)
; Use $DriveLetter /delete
; If @ERROR <> 0
; DBGMessage ( "DisMountError", $DriveLetter)
; EndIf
If ($NT_mode = "no")
DelKey("HKEY_CURRENT_USER\Network\Persistent\" + $DriveLetter)
EndIf
Progress( "Verbinden " + $DriveLetter + " naar " + $Share)
DbgMessage("Info"," - Verbinden " + $DriveLetter + " aan " + $Share)
Use $DriveLetter $Share
If @ERROR <> 0
DBGMessage ( "Fout bij het verbinden", $DriveLetter + " aan " + $Share )
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","ProductSuite")
$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
$os_type=Ltrim(Rtrim(SubStr($os_type+" ",1,3)))
EndFunction

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

; Form
$Form = CreateObject("Kixtart.Form")
$Form.Caption = "Login"
$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="logo.bmp"

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

$OSLbl = $InfoFrame.Label("Besturingssysteem", 5, 15, 115, 15)
$OSBox = $InfoFrame.TextBox("", 120, 15, 115, 15)
$OSBox.BackColor=$Form.BackColor
$OSBox.Enabled=0
$UserIdLbl = $InfoFrame.Label("Acroniem", 5, 30, 115, 15)
$UserIdBox = $InfoFrame.TextBox(@USERID , 120, 30, 115, 15)
$UserIdBox.BackColor=$Form.BackColor
$UserIdBox.Enabled=0
$FullNameLbl = $InfoFrame.Label("Volledige Naam", 5, 45, 115, 15)
$FullNameBox = $InfoFrame.TextBox(@FULLNAME, 120, 45, 115, 15)
$FullNameBox.BackColor=$Form.BackColor
$FullNameBox.Enabled=0
$PriviledgeLbl = $InfoFrame.Label("PC Naam", 5, 60, 115, 15)
$PriviledgeBox = $InfoFrame.TextBox(@WKSTA, 120, 60, 115, 15)
$PriviledgeBox.BackColor=$Form.BackColor
$PriviledgeBox.Enabled=0
$WorkStnLbl = $InfoFrame.Label("Werkstation", 5, 75, 115, 15)
$WorkStnBox = $InfoFrame.TextBox(@WKSTA, 120, 75, 115, 15)
$WorkStnBox.BackColor=$Form.BackColor
$WorkStnBox.Enabled=0
$DomainLbl = $InfoFrame.Label("Domein", 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("Groeplid", 5, 120, 115, 15)
$MemberBox = $InfoFrame.TextBox(@group, 120, 120, 115, 15)
$MemberBox.BackColor=$Form.BackColor
$MemberBox.Enabled=0

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

$NewsRadioButton = $ActionFrame.RadioButton("Ontvangst Nieuws", 5, 15, 230, 15)
$TimeRadioButton = $ActionFrame.RadioButton("Tijd Instellen", 5, 30, 230, 15)
$SharesRadioButton = $ActionFrame.RadioButton("Verbinden met shares", 5, 45, 230, 15)
$StandardSettingsRadioButton = $ActionFrame.RadioButton("Standaard Settings", 5, 60, 230, 15)
$WriteLogFileRadioButton = $ActionFrame.RadioButton("Logfile wegschrijven", 5, 75, 230, 15)

; Logging Frame
$NewsFrame = $Form.Frame("Nieuwsbericht",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