User Tools

Site Tools


userspace:nettime_3.14_network_time_3.14

NetTime 3.14 / Network Time 3.14

Tested with OPSI 4.0.4.0
Winst 4.11.3.11
Works fine with Win7 x86 and x64

By Steve Taube 2014/11/20 12:00

You need the Installer for NetTime
And You can download it here: http://www.timesynctool.com/

Steps

  1. Attention!!! - I have named the install and uninstall files like these: 'setup3264.ins' / 'uninstall3264.ins' / 'delsub3264.ins'
    Please note these when you create the new CLIENT-DATA with opsi-newprod!!!
  2. Create a Directory called 'files' under the CLIENT_DATA-directory
  3. Download the Installer for NetTime 3.14 / Network Time 3.14
    and put it to the CLIENT_DATA\files -directory on your Workbench.
  4. Create two new registry-files named 'nettime32.reg' and 'nettime64.reg'
    and fill it up with the scripts provided down there
    (if you want to install 'NetTime' with your own Specials)
    and put this file in the CLIENT-DATA\files -directory too.
  5. Create new textfiles in the CLIENT_DATA-directory and fill them up with the scripts provided down there.
    You might want to edit some lines in order to fit your needs.
  6. Ready the package and install it on your server.

thats it

setup3264.ins

[Initial]
SetLogLevel=9
;  Log Errors in Logfile but don't abort:
ExitOnError=false
; Show syntax errors in the script:
ScriptErrorMessages=on
; Dont trace step by step through the script:
TraceMode=off
; let started programs run in front of the winst window
StayOnTop=false
 
 
[Actions]
requiredWinstVersion >= "4.11.2.6"
 
DefVar $MsiId32$
DefVar $UninstallProgram32$
DefVar $UninstallProgram32_2$
DefVar $MsiId64$
DefVar $UninstallProgram64$
DefVar $UninstallProgram64_2$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $InstallDir64_2$
DefVar $Regschluessel32$
DefVar $Regschluessel64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
 
DefVar $Flag$
DefVar $WinstRegKey$
DefVar $RebootRegVar$
 
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts, 
; no white space use '-' as a seperator
Set $ProductId$       = "Network Time 3.14"
Set $MinimumSpace$    = "15 MB"
; the path were we find the product after the installation
Set $InstallDir32$      = "%ProgramFiles32Dir%\NetTime"
Set $InstallDir64$      = "%ProgramFiles32Dir%\NetTime"
Set $InstallDir64_2$      = "%ProgramFiles64Dir%\NetTime"
Set $Regschluessel32$	= "Subjective Software"
Set $Regschluessel64$	= "Wow6432Node\Subjective Software"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
 
Set $WinstRegKey$ = "HKLM\SOFTWARE\opsi.org\winst"
Set $Flag$ = GetRegistryStringValue32("["+$WinstRegKey$+"] "+"RebootFlag")
; ----------------------------------------------------------------
 
 
; Script entnommen von http://download.uib.de/opsi4.0/doc/html/opsi-winst-manual/opsi-winst-manual.html#opsi-winst-commands-reboot
 
if not ($Flag$ = "1")
  ;=========================
  ; Anweisungen vor Reboot
 
  ;Files_doSomething
 
  ; Reboot initialisieren ...
  Set $Flag$ = "1"
  Registry_SaveRebootFlag
  ExitWindows /ImmediateReboot
 
else
  ;=========================
  ; Anweisungen nach Reboot
 
  ; Rebootflag zurücksetzen
  Set $Flag$ = "0"
  Registry_SaveRebootFlag
 
  ; die eigentlichen Anweisungen
 
  Sub_Files_doMore
 
endif
 
 
 
comment "ReBoot the System"
ExitWindows /Reboot
 
 
 
 
[Sub_Files_doMore]
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError
	; Stop process and set installation status to failed
else
	comment "Show product picture"
	ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
 
	if FileExists("%ScriptPath%\delsub3264.ins")
		comment "Start uninstall sub section"
		Sub "%ScriptPath%\delsub3264.ins"
	endif
 
	if $LicenseRequired$ = "true"
		comment "Licensing required, reserve license and get license key"
		Sub_get_licensekey
	endif
 
	comment "installing"
 
	if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
		Message "Installing " + $ProductId$ + " 32 Bit..."
		comment "Start setup program"
		ChangeDirectory "%SCRIPTPATH%"
		Winbatch_install
		Sub_check_exitcode
		comment "Patch Registry"
                Winbatch_reg_32
	endif
 
	if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
		Message "Installing " + $ProductId$ + " 64 Bit..."
		comment "Start setup program"
		ChangeDirectory "%SCRIPTPATH%"
		Winbatch_install
		Sub_check_exitcode
		comment "Patch Registry"
                Winbatch_reg_64
	endif
 
endif
 
 
 
[Registry_SaveRebootFlag]
openKey [$WinstRegKey$]
set "RebootFlag" = "$Flag$"
 
 
[Winbatch_install]
"%ScriptPath%\files\NetTimeSetup-314.exe" /silent
 
 
[Winbatch_reg_32]
"%systemroot%\regedit.exe" /s "%scriptpath%\files\nettime32.reg"
 
 
[Winbatch_reg_64]
"%systemroot%\regedit.exe" /s "%scriptpath%\files\nettime64.reg"
 
 
 
DefVar $ServiceErrorClass$
set $ServiceErrorClass$ = getLastServiceErrorClass
comment "Error class: " + $ServiceErrorClass$
 
if $ServiceErrorClass$ = "None"
	comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
else
	if $ServiceErrorClass$ = "LicenseConfigurationError"
		LogError "Fatal: license configuration must be corrected"
		LogError getLastServiceErrorMessage
		isFatalError
	else 
		if $ServiceErrorClass$ = "LicenseMissingError"
			LogError "Fatal: required license is not supplied"
			isFatalError
		endif
	endif
endif
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif

uninstall3264.ins

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
 
[Actions]
requiredWinstVersion >= "4.11.2.6"
 
DefVar $MsiId32$
DefVar $UninstallProgram32$
DefVar $UninstallProgram32_2$
DefVar $MsiId64$
DefVar $UninstallProgram64$
DefVar $UninstallProgram64_2$
DefVar $LogDir$
DefVar $ExitCode$
DefVar $ProductId$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $InstallDir64_2$
DefVar $Regschluessel32$
DefVar $Regschluessel64$
DefVar $LicenseRequired$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
 
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts, 
; no white space use '-' as a seperator
Set $ProductId$       = "Network Time 3.14"
; the path were we find the product after the installation
Set $InstallDir32$      = "%ProgramFiles32Dir%\NetTime"
Set $InstallDir64$      = "%ProgramFiles32Dir%\NetTime"
Set $InstallDir64_2$      = "%ProgramFiles64Dir%\NetTime"
Set $Regschluessel32$	= "Subjective Software"
Set $Regschluessel64$	= "Wow6432Node\Subjective Software"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
; ----------------------------------------------------------------
 
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$
 
Message "Uninstalling " + $ProductId$ + " ..."
 
if FileExists("%ScriptPath%\delsub3264.ins")
	comment "Start uninstall sub section"
	Sub "%ScriptPath%\delsub3264.ins"
endif
 
if $LicenseRequired$ = "true"
	comment "Licensing required, free license used"
	Sub_free_license
endif
 
 
[Sub_free_license]
comment "License management is enabled and will be used"
 
comment "Trying to free license used for the product"
DefVar $result$
Set $result$ = FreeLicense($LicensePool$)
; If there is an assignment of a license pool to the product, it is possible to use
; Set $result$ = FreeLicense("", $ProductId$)
;
; If there is an assignment of a license pool to a windows software id, it is possible to use
; DefVar $WindowsSoftwareId$
; $WindowsSoftwareId$ = "..."
; set $result$ = FreeLicense("", "", $WindowsSoftwareId$)

delsub3264.ins

; Copyright (c) uib gmbh (www.uib.de)
; This sourcecode is owned by uib gmbh
; and published under the Terms of the General Public License.
; credits: http://www.opsi.org/en/credits/
 
 
Set $UninstallProgram32$ = $InstallDir32$ + "\unins000.exe"
 
Set $UninstallProgram64$ = $InstallDir64$ + "\unins000.exe"
Set $UninstallProgram64_2$ = $InstallDir64_2$ + "\unins000.exe"
 
 
if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
	Message "Uninstalling " + $ProductId$ + " 32 Bit..."
 
	if FileExists($UninstallProgram32$)
		comment "Uninstall program found, starting uninstall"
		Winbatch_uninstall_32
		sub_check_exitcode
	endif
 
	comment "Delete files"
	Files_uninstall_32 /32Bit
	comment "Cleanup registry"
	Registry_uninstall_32 /32Bit
endif
 
if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
	Message "Uninstalling " + $ProductId$ + " 64 Bit..."
 
	if FileExists($UninstallProgram64$)
		comment "Uninstall program found, starting uninstall"
		Winbatch_uninstall_64
		sub_check_exitcode
	endif
 
	if FileExists($UninstallProgram64_2$)
		comment "Uninstall program found, starting uninstall"
		Winbatch_uninstall_64_2
		sub_check_exitcode
	endif
 
	comment "Delete files"
	Files_uninstall_64 /64Bit
	comment "Cleanup registry"
	Registry_uninstall_64 /64Bit
endif
 
comment "Delete program shortcuts"
LinkFolder_uninstall
 
 
;ExitWindows /Reboot
 
 
 
[Winbatch_uninstall_32]
; Choose one of the following examples as basis for program uninstall
;
; === Nullsoft Scriptable Install System ================================================================
; maby better Call as
; Winbatch_uninstall /WaitforProcessending "Au_.exe" /Timeoutseconds 10
; "$UninstallProgram32$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgram32$" /silent /norestart /SUPPRESSMSGBOXES /nocancel 
;"$UninstallProgram32$" /silent /norestart 
 
"$UninstallProgram32$" /silent
 
 
 
[Files_uninstall_32]
; Example for recursively deleting the installation directory (don't forget the trailing backslash):
;
; delete -sf "$InstallDir32$\"
 
delete -sf "$InstallDir32$\"
 
 
 
[Registry_uninstall_32]
; Example of deleting a registry key:
;
deletekey [HKEY_LOCAL_MACHINE\Software\$Regschluessel32$]
 
 
 
 
[Winbatch_uninstall_64]
; Choose one of the following examples as basis for program uninstall
;
; === Nullsoft Scriptable Install System ================================================================
; maby better Call as
; Winbatch_uninstall /WaitforProcessending "Au_.exe" /Timeoutseconds 10
; "$UninstallProgram64$" /S
;
; === Inno Setup ========================================================================================
; "$UninstallProgram64$" /silent /norestart /SUPPRESSMSGBOXES /nocancel
; "$UninstallProgram64$" /silent /norestart 
 
"$UninstallProgram64$" /silent
 
[Winbatch_uninstall_64_2]
"$UninstallProgram64_2$" /silent
 
 
 
[Files_uninstall_64]
; Example for recursively deleting the installation directory:
;
; del -sf "$InstallDir64$\"
 
del -sf "$InstallDir64$\"
del -sf "$InstallDir64_2$\"
 
 
 
[Registry_uninstall_64]
; Example of deleting a registry key:
;
deletekey [HKEY_LOCAL_MACHINE\Software\$Regschluessel64$]
 
 
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif



Registry-Files

If you want to install NetTime without your own Specials, please comment the following lines out:

install3264.ins script:

[Winbatch_reg_32]
; "%systemroot%\regedit.exe" /s "%scriptpath%\files\nettime32.reg"
 
 
[Winbatch_reg_64]
; "%systemroot%\regedit.exe" /s "%scriptpath%\files\nettime64.reg"

uninstall3264.ins script:

[Registry_uninstall_32]
; Example of deleting a registry key:
;
;deletekey [HKEY_LOCAL_MACHINE\Software\$Regschluessel32$]
 
 
[Registry_uninstall_64]
; Example of deleting a registry key:
;
;deletekey [HKEY_LOCAL_MACHINE\Software\$Regschluessel64$]

Now you don't need the following Registry-Files!

Please use for the Reg's the Notepad++ Editor!
Attention: Please enter under "Hostname" your correct Time Server (IP) address!!!

nettime32.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Subjective Software]

[HKEY_LOCAL_MACHINE\SOFTWARE\Subjective Software\NetTime]
"Hostname"="192.168.10.23"
"Protocol"=dword:00000000
"Port"=dword:0000007b
"SyncFreq"=dword:00000002
"SyncFreqUnits"=dword:00000003
"LostSync"=dword:00000018
"LostSyncUnits"=dword:00000003
"LargeAdjustmentThreshold"=dword:00000002
"LargeAdjustmentThresholdUnits"=dword:00000002
"LargeAdjustmentAction"=dword:00000000
"Retry"=dword:00000001
"RetryUnits"=dword:00000002
"Server"=dword:00000000
"AlwaysProvideTime"=dword:00000000
"DemoteOnErrorCount"=dword:00000004
"LogLevel"=dword:00000002
"AutomaticUpdateChecks"=dword:00000001
"DaysBetweenUpdateChecks"=dword:00000007
"LastUpdateCheck"=dword:546da24b

nettime64.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Subjective Software]

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Subjective Software\NetTime]
"Hostname"="192.168.10.23"
"Protocol"=dword:00000000
"Port"=dword:0000007b
"SyncFreq"=dword:00000002
"SyncFreqUnits"=dword:00000003
"LostSync"=dword:00000018
"LostSyncUnits"=dword:00000003
"LargeAdjustmentThreshold"=dword:00000002
"LargeAdjustmentThresholdUnits"=dword:00000002
"LargeAdjustmentAction"=dword:00000000
"Retry"=dword:00000001
"RetryUnits"=dword:00000002
"Server"=dword:00000000
"AlwaysProvideTime"=dword:00000000
"DemoteOnErrorCount"=dword:00000004
"LogLevel"=dword:00000002
"AutomaticUpdateChecks"=dword:00000001
"DaysBetweenUpdateChecks"=dword:00000007
"LastUpdateCheck"=dword:546da24b
userspace/nettime_3.14_network_time_3.14.txt · Last modified: 2021/08/23 08:37 (external edit)