and this is the code i have modified hope this makes sense to what i have done wrong again i do have my shares.ini in the right place i think plz help people
Code:
$TRUE = 1
$FALSE = 0
If $Debug=1
$DebugFlag = 1
Else
$DebugFlag = 0
EndIf
$DebugLevel = "Info" ; Info, Debug, Error
$AdminEmail = "itsupport@melville.co.uk" ; Where to send all of the warning messages
$MailServer = "10.1.4.10"
;$Lserver =
$LServer = "\\10.1.4.3"
$LoggingLocation="\\10.5.1.86\it\logs"
$FileLocation="\\10.1.4.3\netlogon"
;$FileLocation=@LDRIVE + "\new"
;$FileLocation="."
;************************************************************ RAS
If @RAS > 0
MessageBox("You are connecting to the Network with a Modem," +@CRLF +"the Logon script will be Skipped","RAS Detected",48)
Exit
EndIf
;************************************************************
;Break Off
Break On
;Default Settings
$os=""
$os_type="xp"
$os_service_pack="2"
$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%")
$CentralSoftwareIniFile=$FileLocation + "\Software.ini"
$LocalSoftwareIniFile=$windir + "\InstalledSoftware.ini"
$GeneralSourceLocation=ReadProfileString($CentralSoftwareIniFile, "Packages", "GeneralSourceLocation")
If Exist($systemdrive + "/program files/utils/kixtart")
$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
OperatingSystem()
$OSBox.Text=SubStr($os,1,22)
; Show News
ShowNews()
; Syncing Time
SyncTime()
; Connecting Drives
ConnectDrives()
If FirstLogonToday()=$True
; Check Software Versions
CheckSoftwareVersions()
; Update Software
InstallSoftware()
; Update Antivirus
UpdateAntivirus()
Else
$CheckSoftwareRadioButton.Value=0
$CheckSoftwareRadioButton.Enabled =0
$InstallSoftwareRadioButton.Value=0
$InstallSoftwareRadioButton.Enabled =0
$AntiVirusRadioButton.Value=0
$AntiVirusRadioButton.Enabled =0
EndIf
; Set machine to stanard Settings
StandardSettings()
; 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 BES_SRV syncronizes with NTP server
;**
Function SyncTime()
$TimeRadioButton.Value=1
DBGMessage ("Info", "Syncing Time:" )
Progress( "Syncing Time")
If $NT_Mode="yes"
SetTime "\\10.5.1.42"
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
;***********************************************************************
;**
;** First time Logon.kix runs today
;**
Function FirstLogonToday()
Progress( "Checking If FirstLogon today")
DbgMessage("Info","Checking If FirstLogon today")
$FirstLogonToday=$False
If Exist($LoggingLocation + "\" + @Wksta + ".log")
$FileDate=Left(GetFileTime ($LoggingLocation + "\" + @Wksta + ".log"),10)
If $FileDate<>@Date
$FirstLogonToday=$True
EndIf
Else
$FirstLogonToday=$True
EndIf
EndFunction
;***********************************************************************
;**
;** Check Software Versions
;**
Function CheckSoftwareVersions()
$CheckSoftwareRadioButton.Value=1
Progress( "Checking Software Versions")
DbgMessage("Info","Check Software Versions:")
If Not Exist($LocalSoftwareIniFile)
If Open(2, $LocalSoftwareIniFile,5) = 0
If WriteLine(2, "# Created : " + @Date + @CRLF)<>0
DbgMessage("Error","$LocalSoftwareIniFile could not be written")
EndIf
If Close(2)<>0
DbgMessage("Error","$LocalSoftwareIniFile could not be closed")
EndIf
Else
DbgMessage("Debug","$LocalSoftwareIniFile could not be written")
EndIf
EndIf
If Exist($CentralSoftwareIniFile)
$Numpackages=1
$CentralAppName = ReadProfileString($CentralSoftwareIniFile, "Packages", "" + $Numpackages + "_AppName")
While $CentralAppName<>"" AND @Error=0
$CentralAppVersion = ReadProfileString($CentralSoftwareIniFile, $CentralAppName, "Version")
Progress( "Checking For : " + $CentralAppName + " v. " + $CentralAppVersion)
DbgMessage("Info","Checking For : " + $CentralAppName + " v. " + $CentralAppVersion)
; Check Version On Machine
$LocalAppVersion = ReadProfileString($LocalSoftwareIniFile,$CentralAppName,"Version")
If @Error = 0
If $LocalAppVersion <> $CentralAppVersion
; Add to updating List
Progress( $CentralAppName + " v. " + $LocalAppVersion + " needs updating")
DbgMessage("Info",$CentralAppName + " v. " + $LocalAppVersion + " needs updating")
$UpdateSoftware[$Updates]=$CentralAppName
DbgMessage("Debug",$UpdateSoftware[$Updates])
$RunUpdates=$True
$Updates = $Updates + 1
ReDim PRESERVE $UpdateSoftware[$Updates]
EndIf
EndIf
$Numpackages=$Numpackages+1
$CentralAppName = ReadProfileString($CentralSoftwareIniFile, "Packages", "" + $Numpackages + "_AppName")
Loop
If $Updates > 0
$Updates = $Updates - 1
ReDim PRESERVE $UpdateSoftware[$Updates]
EndIf
Else
DbgMessage("Error",$CentralSoftwareIniFile + " Could not be opened")
EndIf
$CheckSoftwareRadioButton.Value=0
$CheckSoftwareRadioButton.Enabled =0
EndFunction
;***********************************************************************
;**
;** UpdateSoftware()
;**
Function InstallSoftware()
$InstallSoftwareRadioButton.Value=1
If $RunUpdates=$True
For $Installing = 0 to $Updates
DbgMessage("Info","Updating : ------------ " + $UpdateSoftware[$Installing])
$ActionFile = ReadProfileString($CentralSoftwareIniFile, $UpdateSoftware[$Installing], "ActionFile")
$ActionType = ReadProfileString($CentralSoftwareIniFile, $UpdateSoftware[$Installing], "ActionType")
Select
Case $ActionType="KIX"
$SourceLocation = $GeneralSourceLocation + ReadProfileString($CentralSoftwareIniFile, $UpdateSoftware[$Installing], "SourceLocation")
$Destination = ReadProfileString($CentralSoftwareIniFile, $UpdateSoftware[$Installing], "Destination")
$Script=$SourceLocation + "\" + $ActionFile
If Exist($Script)
DbgMessage("Info","Call " + $Script)
Call $Script
If @ERROR=0
DbgMessage("Info","Update : Success")
Else
DbgMessage("Error","Update : Error: " + @Error + " - " + @SERROR )
EndIf
Else
DbgMessage("Error", $Script + " Could not be found")
EndIf
Case $ActionType="MSI"
$SourceLocation = $GeneralSourceLocation + ReadProfileString($CentralSoftwareIniFile, $UpdateSoftware[$Installing], "SourceLocation")
$Destination = $GeneralSourceLocation + ReadProfileString($CentralSoftwareIniFile, $UpdateSoftware[$Installing], "Destination")
$Version = ReadProfileString($CentralSoftwareIniFile, $UpdateSoftware[$Installing], "Version")
If MSIInstaller($SourceLocation,$Destination,$ActionFile)=0
If WriteProfileString($LocalSoftwareIniFile, $UpdateSoftware[$Installing], "Version", $Version)<>0
stpDbgMessage("Error","Ini File could not be updated")
EndIf
DbgMessage("Info","Update : Success")
Else
DbgMessage("Error","Update : Error: " + @Error + " - " + @SERROR )
EndIf
Case $ActionType="EXE"
$SourceLocation = $GeneralSourceLocation + ReadProfileString($CentralSoftwareIniFile, $UpdateSoftware[$Installing], "SourceLocation")
; Not yet Implemented
; Run Exe File
;Shell "Exe"
Case $ActionType="BAT"
$SourceLocation = $GeneralSourceLocation + ReadProfileString($CentralSoftwareIniFile, $UpdateSoftware[$Installing], "SourceLocation")
; Not yet Implemented
; Run Bat File
;Shell "Bat"
Case $ActionType="INF"
$SourceLocation = $GeneralSourceLocation + ReadProfileString($CentralSoftwareIniFile, $UpdateSoftware[$Installing], "SourceLocation")
; Not yet Implemented
; Run INF File
;Shell "INF"
EndSelect
DbgMessage("Info","Done : ------------ " + $UpdateSoftware[$Installing])
Next
EndIf
$InstallSoftwareRadioButton.Value=0
$InstallSoftwareRadioButton.Enabled =0
EndFunction
;***********************************************************************
;**
;** MSIInstaller()
;**
; MSIEXEC.EXE - the MSI executable, the program that performs the actual installation of the application.
; /I - this switch informs the Windows Installer to install the specified application (as opposed to removing, reinstalling OR repairing the application)
; /QB- - this switch instructs the Windows Installer to perform the installation with a basic user interface requiring no dialog boxes to be displayed.
; You might also Use /QN- to perform the installation with no user interface AT all.
; /LWAMOE c:\temp\install.log - this switch instructs the Windows Installer to generate a log file AT the specified path AND file name (in this Case, "c:\temp\install.log")
; AND to include the following details: Non fatal errors, start up actions, out of memory OR fatal Exit information, out of disk space messages AND all error messages. There are several other options (see our FAQ For more details) to include all possible details in the log file Use "/L* c:\temp\install.log"
; ALLUSERS=1 - including this will cause the shortcuts For the application to be placed in "all users" instead of the current user profile.
; see http://appdeploy.com/faq/windowsinstaller/wi-faq-13.shtml for more options
; /faums Reinstall
Function MSIInstaller($SourceLocation,$Destination,$ActionFile)
;Check if MSI Installer is installed
If Exist ($Destination + "\*.ini")
$inifile=Dir($Destination + "\*.ini")
CopyFiles($Destination, "*.ini", $tmpdir)
EndIf
If NOT Exist($windir + "\Installer")
If $NT_Mode="yes"
Shell $GeneralSourceLocation + "\MSIInstaller\InstMsiW.exe /q"
If @ERROR=0
DbgMessage("Info","Update : Success")
Else
DbgMessage("Error","Update : Error: " + @Error + " - " + @SERROR )
EndIf
Else
Shell $GeneralSourceLocation + "\MSIInstaller\InstMsiA.exe /q"
If @ERROR=0
DbgMessage("Info","Update : Success")
Else
DbgMessage("Error","Update : Error: " + @Error + " - " + @SERROR )
EndIf
EndIf
EndIf
;Run MSI File
If Exist($windir + "\system32\msiexec.exe")
$msiexec=$windir + "\system32\msiexec.exe"
Else
$msiexec=$windir + "\system\msiexec.exe"
EndIf
$msiinstall=" /i " + $SourceLocation + "\" + $ActionFile
$msioptions=" /QN"
$msilogging=" /LWAMOE " + $windir + "\Install_" + $UpdateSoftware[$Installing] + ".log"
; DbgMessage("Info","SHELL " + $comspec + " /c " + $msiexec + $msiinstall + $msioptions + $msilogging)
Shell $msiexec + $msiinstall + $msioptions + $msilogging
If @Error<>0
$MSIInstaller=@Error + " - Additional Info : " + @Serror
Else
$MSIInstaller=@Error
EndIf
If $inifile<>""
CopyFiles($Destination, $inifile, $Destination)
EndIf
EndFunction
;***********************************************************************
;**
;** UpdateAntivirus
;**
Function UpdateAntivirus()
$AntiVirusRadioButton.Value=1
; Not yet Implemented
$AntiVirusRadioButton.Value=0
$AntiVirusRadioButton.Enabled =0
EndFunction
;***********************************************************************
;**
;** Connect Shares to Drives
;**
Function ConnectDrives()
$SharesRadioButton.Value=1
Progress( "Connecting Drives")
DbgMessage("Info","Connecting Drives:")
; ConnectHomeDrive()
ConnectDefaultDrives()
COnnectGroupDrives()
$SharesRadioButton.Value=0
$SharesRadioButton.Enabled =0
EndFunction
;***********************************************************************
;**
;** Connect Home Drive
;**
Function ConnectHomeDrive()
;******************************
; Home DriveShares
;******************************
Progress( "Connecting H:")
DbgMessage("Info"," - H: = " + @HOMESHR)
Use; H: /delete
If ($NT_mode = "no")
DelKey("HKEY_CURRENT_USER\Network\Persistent\H")
EndIf
Use H: @HOMESHR
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", "SemecsAll", "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", "$SemecsAll", "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:")
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( "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
;************************************************************
;** Function: ConnectShare
;** Usage: ConnectShare ("H:, \\fileserver-2\home, 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
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 = "Melville Exhibition Services Logon 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="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(@group, 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)
$CheckSoftwareRadioButton = $ActionFrame.RadioButton("Check Software Versions", 5, 60, 230, 15)
$InstallSoftwareRadioButton = $ActionFrame.RadioButton("Install Software", 25, 75, 230, 15)
$AntiVirusRadioButton = $ActionFrame.RadioButton("Update Antivirus", 5, 90, 230, 15)
$StandardSettingsRadioButton = $ActionFrame.RadioButton("Standard 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