Code:
;**************************************************************
;** Script:	Login Script
;** Version:	1.0
;** 
;** Author:	Mathieu van der Heijden
;** E-mail:	xxxxxxxxxxxxx@hotmail.com
;**
;**************************************************************

;Break Off
Break On

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

Global $UpdateSoftware[0]
$userid=@userid
$Updates=0
$RunUpdates=$False
$tmpdir=ExpandEnvironmentVars("%tmp%")
$systemdrive=ExpandEnvironmentVars("%systemdrive%")
$windir=ExpandEnvironmentVars("%windir%")
$comspec=ExpandEnvironmentVars("%comspec%")
$Filelocation=ExpandEnvironmentVars("\\dc1\netlogon")

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

;Main Application

; Draw Form
	DrawForms()

; Show News
	ShowNews()
	
; Connecting Drives
	ConnectDrives()

; Set machine to standard Settings
	StandardSettings()

; Create Temp Folders and Files
	Tempfolders()

; Fill Progressbar
While $ProgressBar.Value < 100
	Progress("Afronden",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

;***********************************************************************
;**
;**  Connect Shares to Drives
;**
Function ConnectDrives()
	$SharesRadioButton.Value=1
	Progress( "Connecting Drives")
	DbgMessage("Info","Connecting Drives:")
	Groepbepaling()
	ConnectHomeDrive()
	ConnectDefaultDrives()
	$SharesRadioButton.Value=0
	$SharesRadioButton.Enabled =0	
EndFunction

;***********************************************************************
;**
;**  Connect Home Drive
;**
Function ConnectHomeDrive()
	;******************************	
	; Home DriveShares
	;******************************	
	Progress( "Connecting H:")
	DbgMessage("Info","  - Y: = " + "\\dc1\users\$userid")
	
	Use H: /delete
	If ($NT_mode = "no") 
		DelKey("HKEY_CURRENT_USER\Network\Persistent\Y")
	EndIf
	Use H: "\\dc1\users\$userid"
		If @ERROR = 0
			DbgMessage ("Info","Home Share Connected")
		Else
			DBGMessage ("HOMESHR","No Home Share available")
			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", "EVERYONE", "drive" + $x)
			If @ERROR = 0
				If $DriveDefinition<>""
			  		ConnectShare($DriveDefinition)
				EndIf
			Else
				Return
			EndIf
		Next
	EndIf
EndFunction

;***********************************************************************
;**
;**  Zorgen dat je een bepaalde groupshare krijgt door groeplidmaatschap
;**  
Function Groepbepaling()
	if ingroup ("Directie") $Group="Directie" ConnectGroupDrives() endif
	if ingroup ("Networking") $Group="Networking" ConnectGroupDrives() endif
Endfunction


;***********************************************************************
;**
;**  Connect GroupShares to Drives
;**
Function ConnectGroupDrives()
	;******************************	
	; GroupShares
	;******************************
	If Exist($FileLocation + "\shares.ini")
	DBGMessage ("Testing Groupshares",$group)
		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
	EndIf
EndFunction

;************************************************************************
;**
;** Set machine to default settings
;**
Function StandardSettings()
	$StandardSettingsRadioButton.Value=1
	Progress( "Setting Standard Settings")
	DbgMessage("Info","Setting standard settings:")	
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iCountry" , "31" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iCurrency" , "2" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iDate" , "1" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iFirstDayOfWeek" , "0" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iFirstWeekOfYear" , "2" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iMeasure" , "0" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iNegCurr" , "11" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "iTime" , "1" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "Local" , "413" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "s1159" , "" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "s2359" , "" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sCountry" , "Netherlands" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sCurrency" , "€" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sDate" , "-" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sDecimal" , "," , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sLanguage" , "NLD" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sList" , ";" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sMonDecimalSep" , "," , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sMonThousandSep" , "." , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sShortDate" , "dd-MM-yyyy" , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sThousand" , "." , "REG_SZ")
		writevalue("HKEY_CURRENT_USER\Control Panel\International" , "sTimeFormat" , "H:mm:ss" , "REG_SZ")
		writevalue( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" , "TaskbarSizeMove" , "0" , "REG_DWORD" )
		writevalue( "HKEY_CURRENT_USER\Control Panel\Colors" , "Background" , "50 240 0" , "REG_SZ")
		writevalue( "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects", "VisualFXSetting" , "2" , "REG_DWORD" )

		;****** Default Printer 
		$defprint = ReadValue("HKEY_CURRENT_USER\Software\Lantack", "defaultprinter")
		WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows", "device", "$defprint", "REG_SZ")

	$StandardSettingsRadioButton.Value=0
	$StandardSettingsRadioButton.Enabled=0
EndFunction

;************************************************************************
;**
;** Tijdelijke mappen aanmaken 
;**
Function Tempfolders()
	$TempfoldersRadioButton.Value=1
	Progress( "Tijdelijke mappen worden aangemaakt")
	DbgMessage("Info", "Tijdelijke mappen aanmaken")

	$TempfoldersRadioButton.Value=0
	$TempfoldersRadioButton.Enabled=0
EndFunction

;************************************************************
;** Function: ConnectShare 
;** Usage: ConnectShare ("H:, \\OXYGEN\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( "Connecting " + $DriveLetter + " to " + $Share)
	DbgMessage("Info","  - Connecting " + $DriveLetter + " on " + $Share)
	Use $DriveLetter $Share
	If @ERROR <> 0
		DBGMessage ( "MountError", $DriveLetter + " on " + $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", "DuhhBugg" ) 
;** 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

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

; Form
	$Form = CreateObject("Kixtart.Form")
	$Form.Caption = "PoliForm Login Script"
	$Form.Width = 500
	$Form.Height = 500
	If $DebugFlag=$True
		$Form.Left=(1280 / 2) - (500 / 2)
		$Form.Top=(1024  / 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=203
	$Logo.Height=239
	$Logo.Picture="reddev10.bmp"

; Info Frame 
	$InfoFrame = $Form.Frame("Informatie", 250,5,240,120)
		
	$UserIdLbl = $InfoFrame.Label("Username", 5, 15, 115, 15)
	$UserIdBox = $InfoFrame.TextBox(@USERID	, 120, 15, 115, 15)
	$UserIdBox.BackColor=$Form.BackColor
	$UserIdBox.Enabled=0
	$FullNameLbl = $InfoFrame.Label("Full Name", 5, 30, 115, 15)
	$FullNameBox = $InfoFrame.TextBox(@FULLNAME, 120, 30, 115, 15)
	$FullNameBox.BackColor=$Form.BackColor
	$FullNameBox.Enabled=0
	$WorkStnLbl = $InfoFrame.Label("Terminal Server", 5, 45, 115, 15)
	$WorkStnBox = $InfoFrame.TextBox(@WKSTA, 120, 45, 115, 15)
	$WorkStnBox.BackColor=$Form.BackColor
	$WorkStnBox.Enabled=0
	$DomainLbl = $InfoFrame.Label("Domein", 5, 60, 115, 15)
	$DomainBox = $InfoFrame.TextBox(@DOMAIN, 120, 60, 115, 15)
	$DomainBox.BackColor=$Form.BackColor
	$DomainBox.Enabled=0
	$TimeLbl = $InfoFrame.Label("Tijd", 5, 75, 115, 15)
	$TimeBox = $InfoFrame.TextBox(@TIME, 120, 75, 115, 15)
	$TimeBox.BackColor=$Form.BackColor
	$TimeBox.Enabled=0
	$DateLbl = $InfoFrame.Label("Datum", 5, 90, 115, 15)
	$DateBox = $InfoFrame.TextBox(@DATE, 120, 90, 115, 15)
	$DateBox.BackColor=$Form.BackColor
	$DateBox.Enabled=0

; Action Frame
	$ActionFrame = $Form.Frame("Bewerkingen",250,125,240,120)
	
	$NewsRadioButton = $ActionFrame.RadioButton("Bericht weergeven", 5, 15, 230, 15)
	$SharesRadioButton = $ActionFrame.RadioButton("Netwerkverbindingen maken", 5, 30, 230, 15)
	$StandardSettingsRadioButton = $ActionFrame.RadioButton("Standaard instellingen", 5, 45, 230, 15)			
	$TempfoldersRadioButton = $ActionFrame.RadioButton("Tijdelijke mappen aanmaken", 5, 60, 230, 15)

; Logging Frame
	$NewsFrame = $Form.Frame("Nieuws",5,250,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=400
	$ProgressTextBox.Width=200
	$ProgressTextBox.Height=20
	$ProgressTextBox.Enable=0
	$ProgressTextBox.BackColor = $Form.BackColor	
	
	$ProgressBar = $Form.ProgressBar
	$ProgressBar.Left=210
	$ProgressBar.Top=400
	$ProgressBar.Width=220
	$ProgressBar.Height=20
	$ProgressBar.Style = 1

; Clock
	$CurrentTime=@Time
	$Clock = $Form.TextBox("",435,400,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 = 300
	$DbgForm.Height = 300
	$DbgForm.Left=1280 - 300
	$DbgFOrm.Top=1024 - 300
	
	$DbgTextBox=$DbgForm.TextBox()
	$DbgTextBox.Left=5
	$DbgTextBox.Top=5
	$DbgTextBox.Width=235
	$DbgTextBox.Height=205
	$DbgTextBox.MultiLine=1
	$DbgTextBox.Enable=0
	$DbgTextBox.Text=""
	$DbgTextBox.ScrollBars=2
	$DbgTextBox.Wordwrap=1	
	
	$CurrentX=0
	$CurrentY=0
;	$DbgForm.Show
;*********************************************************************************
;*************************************************
;**********************
;Om het debugwindow weer te geven moet de ";" voor $DbgForm.Show weggehaald worden
;**********************
;*************************************************
;*********************************************************************************

EndIf	

EndFunction


here is the full code


Edited by Arend_ (2016-12-14 01:13 PM)
Edit Reason: Removed email addres from code.