-
Notifications
You must be signed in to change notification settings - Fork 4
/
Install-Certs.wsf
97 lines (62 loc) · 2.39 KB
/
Install-Certs.wsf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<job id="Install-Certs">
<script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
<script language="VBScript">
' //----------------------------------------------------------------------------
' //
' // Solution: Richard's Deployment Script
' // File: Install-Certs.wsf
' //
' // Purpose: This will use certutil to install certs from JDI
' //
' // Author: Richard Tracy
' //
' // Usage: cscript Install-Certs.wsf [/debug:true]
' //
' //----------------------------------------------------------------------------
'//----------------------------------------------------------------------------
'// Global constant and variable declarations
'//----------------------------------------------------------------------------
Option Explicit
Dim iRetVal
'//----------------------------------------------------------------------------
'// Main routine
'//----------------------------------------------------------------------------
'On Error Resume Next
iRetVal = ZTIProcess
ProcessResults iRetVal
On Error Goto 0
'//---------------------------------------------------------------------------
'// Function: ZTIProcess()
'//---------------------------------------------------------------------------
Function ZTIProcess()
Dim sInstallName
Dim sCertDirPath
Dim objFolder, objFile
'// Variables
sInstallName = "Certs"
sCertDirPath = oUtility.ScriptDir & "\Certs"
'// Start the process
oLogging.CreateEntry "Starting to add JDI certs to the certificate store", LogTypeInfo
'// Disable Zone Checks
oEnv("SEE_MASK_NOZONECHECKS") = 1
'Install DOD Root Certs
'set the a variable to point to our folder with the files in it.
Set objFolder=oFSO.GetFolder(sCertDirPath)
for each objFile in objFolder.Files
if UCase(oFSO.GetExtensionName(objFile.name)) = "CER" Then
oLogging.CreateEntry "Importing certificate: """ & sCertDirPath & "\" & objFile.Name & "", LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("certutil.exe -f -addstore -enterprise -user root """ & sCertDirPath & "\" & objFile.Name, 0, True)
end if
Next
if (iRetVal = 0) or (iRetVal = 1) then
oLogging.CreateEntry "Finished adding JDI Certificate successfully", LogTypeInfo
Else
oLogging.CreateEntry "Import failed. Return code from command = " & iRetVal, LogTypeError
End If
'always end success
ZTIProcess = Success
'// Enable Zone Checks
oEnv.Remove("SEE_MASK_NOZONECHECKS")
End Function
</script>
</job>