Files
2025-12-14 15:46:14 +01:00

174 lines
4.7 KiB
Plaintext

Option Explicit
Dim pName, pVersion, pLang, pRevision
pName = "Audi_JavaSecurityConfig"
pVersion = "4.01"
pLang = "NTR"
pRevision = "91"
'----- Functions.vbs einbinden
Dim olibfso : Set olibfso = CreateObject("Scripting.FileSystemObject")
ExecuteGlobal olibfso.OpenTextFile(olibfso.GetParentFolderName(Wscript.ScriptFullName) + "\_Functions.vbs", 1, false).ReadAll
Set olibfso = nothing
LogEnabled = True
ClientInfo()
'----- Clients (Delete this block if not needed)
AC1_32_O = 1
AC2_32_O = 1
AC2_64_O = 1
AC2_32_N = 1
AC2_64_N = 1
AC3_Alpha = 1
ClientCheck()
'----- START Installation -----
Dim TrustWare32 : TrustWare32 = """" & ProgramFiles & "\IT Solution GmbH\trustWare CSP+ v1.1.0.12\32\itcspsrv.exe"""
Dim TrustWare64 : TrustWare64 = """" & ProgramFiles & "\IT Solution GmbH\trustWare CSP+ v1.1.0.12\64\itcspsrv.exe"""
' Altes Paket entfernen
VbsLog "----- Start Deinstallation " & pName & " " & pVersion
DeleteReg "KEY","HKLM\Software\AudiAG\InstalledProducts\" & pName & "\",32
'Kopieren systemweite deployment.properties
CreateFolder WinDir & "\Sun\Java\Deployment"
CopyFile "Source\Deployment\*.*",WinDir & "\Sun\Java\Deployment"
'Disable Java Deployment Expiration Check
Dim HighestJavaPath : HighestJavaPath = GetHighestJavaPath(ProgramFiles & "\Java")
If Not IsNull(HighestJavaPath) Then
run "Disable Expiration Check","""" & HighestJavaPath & "\bin\javaws"" -userConfig deployment.expiration.check.enabled false",""
End If
'Kopieren der Zertifikate
CopyCerts(ProgramFiles & "\Java")
If GetOSBit()=64 Then CopyCerts(ProgramFiles64 & "\Java")
'Trustware
If CheckFile(TrustWare32) Then run "CSP+ 32",TrustWare32 & " installjava","0"
If GetOSBit() = 64 Then
If CheckFile(TrustWare64) Then run "CSP+ 64",TrustWare64 & " installjava","0"
End If
WriteRegInfo "0"
' Notwendiger RegKey für die permanente Neuinstallations-Möglichkeit sorgt
WriteReg "REG_DWORD", "HKLM\Software\ApplicationPacks\JavaConfig", 1, 32
' Ausführen von C:\PROGRAM FILES\Java\[any Java Runtime]\bin\ssvagent.exe -new
RunAgent ProgramFiles & "\Java"
'----- ENDE Installation -----
FinishScript()
Sub RunAgent(Folder)
Dim Dir,SubDir,JavaVer
If Not CheckFolder(Folder) Then Exit Sub
Set Dir = FSO.GetFolder(Folder)
For Each SubDir In Dir.SubFolders
JavaVer=Null
If Left(LCase(SubDir.Name),4)="jre7" Or Left(LCase(SubDir.Name),6)="jre1.7" Then
JavaVer="jre7"
ElseIf Left(LCase(SubDir.Name),4)="jre8" Or Left(LCase(SubDir.Name),6)="jre1.8" Then
JavaVer="jre8"
ElseIf Left(LCase(SubDir.Name),4)="jre9" Then
JavaVer="jre9"
Else
VbsLog "Information | '" & SubDir.Path & "' ist unbekannte Java Version"
End If
If Not IsNull(JavaVer) Then
VbsLog "Information | '" & SubDir.Path & "' ist " & JavaVer
If CheckFolder(SubDir.Path & "\bin") Then
RunNoWait "Run", SubDir.Path & "\bin\ssvagent.exe -new"
End If
End If
Next
End Sub
Sub CopyCerts(Folder)
Dim Dir,SubDir,JavaVer
If Not CheckFolder(Folder) Then Exit Sub
Set Dir = FSO.GetFolder(Folder)
For Each SubDir In Dir.SubFolders
JavaVer=Null
If Left(LCase(SubDir.Name),4)="jre7" Or Left(LCase(SubDir.Name),6)="jre1.7" Then
JavaVer="jre7"
ElseIf Left(LCase(SubDir.Name),4)="jre8" Or Left(LCase(SubDir.Name),6)="jre1.8" Then
JavaVer="jre8"
ElseIf Left(LCase(SubDir.Name),4)="jre9" Then
JavaVer="jre9"
Else
VbsLog "Information | '" & SubDir.Path & "' ist unbekannte Java Version"
End If
If Not IsNull(JavaVer) Then
VbsLog "Information | '" & SubDir.Path & "' ist " & JavaVer
If CheckFolder(SubDir.Path & "\lib\security") Then
CopyFile "Source\CA-Trusted-Certs_VWG\*.*",SubDir.Path & "\lib\security\"
If CheckFolder("Source\JCE_VWG\" & JavaVer) Then
CopyFile "Source\JCE_VWG\" & JavaVer & "\*.*",SubDir.Path & "\lib\security\"
End If
End If
End If
Next
End Sub
Function GetHighestJavaPath(Folder)
Dim Dir,Item,Name,Version,VersionMax,Path
VersionMax = 0
If Not CheckFolder(Folder) Then
VbsLog "Kein Java gefunden in '" & Folder & "'"
GetHighestJavaPath = Null
Exit Function
End If
Set Dir = FSO.GetFolder(Folder)
For Each Item In Dir.SubFolders
If CheckFile(Item.Path & "\bin\java.exe") Then
Version=GetFileVersion(Item.Path & "\bin\java.exe")
End If
If VersionCheck(VersionMax,Version) < 0 Then
VersionMax = Version
Path = Item.Path
End If
Next
If VersionMax > 0 Then
GetHighestJavaPath = Path
Else
GetHighestJavaPath = Null
End If
End Function
Sub WriteRegInfo(ErrorLevel)
Dim RegRoot
RegRoot = "HKLM\Software\AudiAG\InstalledProducts\" & pName
WriteReg "SZ",RegRoot & "\Version",pVersion,32
WriteReg "SZ",RegRoot & "\Revision",pRevision,32
WriteReg "SZ",RegRoot & "\Language",pLang,32
If UBound(errorList0)>=0 Then
WriteReg "SZ",RegRoot & "\ErrorLevel",Join(errorList0,","),32
Else
WriteReg "SZ",RegRoot & "\ErrorLevel",ErrorLevel,32
End If
End Sub