-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathInstall-90Meter.wsf
211 lines (166 loc) · 8.89 KB
/
Install-90Meter.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
<job id="Install-90Meter">
<script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
<script language="VBScript">
' //----------------------------------------------------------------------------
' //
' // Solution: Richard's Deployment Script
' // File: Install-90Meter.wsf
' //
' // Purpose: This will install 90Meter
' //
' // Author: Richard Tracy
' //
' // Usage: cscript Install-90Meter.wsf [/arch:x64|x86] [/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 sVersion,sArch,sFile
Dim sPrefix
Dim sInstallName, sInstallerPath
Dim sLogFolder,sLogName,sLogPath
Dim sCertRootInstaller,sCertRootInstallerPath
Dim sCertDirPath,sSettingsPath
Dim sRegCmd
'// Apply Architecture arguments:
'If no argument provided check for MDT/SCCM variable
'If no variable or argument is provided, defualt to x86
If oUtility.Arguments.Exists("arch") Then
sArch = LCase(oUtility.Arguments("arch"))
ElseIf oEnvironment.Exists("Architecture") Then
sArch = LCase(oEnvironment.Item("Architecture"))
Else
sArch = "x86"
End If
' check if MDT variable exists
If oUtility.Arguments.Exists("prefix") Then
sPrefix = LCase(oUtility.Arguments("prefix"))
ElseIf oEnvironment.Exists("Prefix") Then
sPrefix = oEnvironment.Item("Prefix")
End if
'// Variables:
'// Change if needed
sVersion = "1.4.33"
sArch = "x64"
If sArch = "x64" then
sFile = "SCM_"& sVersion &"_64Bit_S_RC4.msi"
Else
sFile = "SCM_"& sVersion & "_32Bit_S_RC4..msi"
End If
If sArch = "x64" then
sCertRootInstaller = "InstallRoot_SIPR_5.2x64.msi"
Else
sCertRootInstaller = "InstallRoot_SIPR_5.2x32.msi"
End If
sInstallName = "90Meter"
sInstallerPath = oUtility.ScriptDir & "\Source\" & sVersion & "\" & sFile
sCertRootInstallerPath = oUtility.ScriptDir & "\Configs\" & sCertRootInstaller
sCertDirPath = oUtility.ScriptDir & "\Certs\"
'// Build log path (incase not used in task sequence)
If oEnvironment.Exists("_SMSTSLogPath") Then
sLogFolder = oEnvironment.Item("_SMSTSLogPath") & "\AppLogs"
Else
sLogFolder = oEnv("TEMP") & "\AppLogs"
End If
oUtility.VerifyPathExists sLogFolder
sLogName = Replace(sInstallName & "_" & sVersion & "_" & sArch & ".log"," ","")
sLogPath = sLogFolder & "\" & sLogName
'// Start the process
oLogging.CreateEntry "Starting " & sInstallName & " (" & sVersion & ") " & sArch & " installation", LogTypeInfo
If not oFSO.FileExists(sInstallerPath) then
oLogging.CreateEntry sInstallerPath & " was not found, unable to install " & sInstallName & " (" & sVersion & ")", LogTypeError
ZTIProcess = Failure
Exit Function
End if
'// Disable Zone Checks
oEnv("SEE_MASK_NOZONECHECKS") = 1
iRetVal = oUtility.RunWithHeartbeat("""" & oUtility.ScriptDir & "\Configs\Control_Vault\CVHCI64.exe"" /S /v/qn")
iRetVal = oUtility.RunWithHeartbeat("msiexec /q ALLUSERS=2 /m MSIHARSK /i """ & sInstallerPath & """ /l*v """ & sLogPath & """")
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
sSettingsPath = "C:\Users\default\AppData\Local\Litronic\OCM"
oUtility.VerifyPathExists sSettingsPath
oUtility.VerifyPathExists (oEnv("LocalAppData") & "\Litronic\OCM")
oFSO.CopyFile (oUtility.ScriptDir & "\Configs\middleware.settings"), (sSettingsPath & "\middleware.settings"), True
oFSO.CopyFile (oUtility.ScriptDir & "\Configs\middleware.settings"), (oEnv("LocalAppData") & "\Litronic\OCM\middleware.settings"), True
iRetVal = oUtility.RunWithHeartbeat("msiexec /i """ & sCertRootInstallerPath & """ /qn /norestart")
DeleteFile "C:\Users\Public\Desktop","InstallRoot SIPR 5.2.lnk"
'Import Root Certs
Dim objFolder, objFile
Set objFolder = oFSO.GetFolder(sCertDirPath & "\" & UCase(sPrefix) & "\Root")
for each objFile in objFolder.Files
if UCase(oFSO.GetExtensionName(objFile.name)) = "CER" Then
oLogging.CreateEntry "importing to root certificate store: """ & sCertDirPath & "\" & UCase(sPrefix) & "\Root\" & objFile.Name & "", LogTypeInfo
'iRetVal = oUtility.RunWithHeartbeat("""" & oUtility.ScriptDir & "\Certs\certmgr.exe"" -add """ & sCertDirPath & "\" & UCase(sPrefix) & "\Root\" & objFile.Name & " -c -s -r localMachine Root")
iRetVal = oUtility.RunWithHeartbeat("certutil.exe -f -addstore -enterprise -user root """ & sCertDirPath & "\" & UCase(sPrefix) & "\Root\" & objFile.Name & """")
end if
WScript.Sleep 1000
Next
'Import Sub Certs
Set objFolder = oFSO.GetFolder(sCertDirPath & "\" & UCase(sPrefix) & "\Sub")
for each objFile in objFolder.Files
if UCase(oFSO.GetExtensionName(objFile.name)) = "CER" Then
oLogging.CreateEntry "importing to root certificate store: """ & sCertDirPath & "\" & UCase(sPrefix) & "\Sub\" & objFile.Name & "", LogTypeInfo
'iRetVal = oUtility.RunWithHeartbeat("""" & oUtility.ScriptDir & "\Certs\certmgr.exe"" -add """ & sCertDirPath & "\" & UCase(sPrefix) & "\Sub\" & objFile.Name & " -c -s -r localMachine CA")
iRetVal = oUtility.RunWithHeartbeat("certutil.exe -f -addstore CA """ & sCertDirPath & "\" & UCase(sPrefix) & "\Sub\" & objFile.Name & """")
end if
WScript.Sleep 1000
Next
'Import 90 Meter signing Certs
iRetVal = oUtility.RunWithHeartbeat("""" & oUtility.ScriptDir & "\Certs\certmgr.exe"" -add """ & sCertDirPath & "\90m_CodeSigning_Cert.cer"" -c -s -r localMachine TrustedPublisher")
'iRetVal = oUtility.RunWithHeartbeat("""" & oUtility.ScriptDir & "\Certs\certmgr.exe"" -add """ & sCertDirPath & "\DigiSub.cer"" -c -s -r localMachine Root")
'iRetVal = oUtility.RunWithHeartbeat("""" & oUtility.ScriptDir & "\Certs\certmgr.exe"" -add """ & sCertDirPath & "\DigiRoot.cer"" -c -s -r localMachine Root")
'iRetVal = oUtility.RunWithHeartbeat("certutil.exe -f –addstore TrustedPublisher """ & sCertDirPath & "\90m_CodeSigning_Cert.cer")
iRetVal = oUtility.RunWithHeartbeat("certutil.exe -f -addstore -enterprise -user root """ & sCertDirPath & "\DigiRoot.cer""")
iRetVal = oUtility.RunWithHeartbeat("certutil.exe -f -addstore -enterprise -user root """ & sCertDirPath & "\DigiSub.cer""")
'If oEnvironment.Item("IsVM") = "False" Then
oLogging.CreateEntry "Installing drivers for the OMNIKEY3x2x Reader on " & sArch & " systems", LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & oUtility.ScriptDir & "\Configs\HID_OMNIKEY3x2x_" & sArch & "_W7_R1_2_24_27.exe"" /noreboot /S /v/qn")
oLogging.CreateEntry "Installing drivers for the SCR3xx Reader on " & sArch & " systems", LogTypeInfo
iRetVal = oUtility.RunWithHeartbeat("""" & oUtility.ScriptDir & "\Configs\SCR3xx_Driver_V4.67\dpinst.exe"" /LM /SA /SW /S")
'End If
sRegCmd = "cmd.exe /c " & oEnv("SystemRoot") & "\regedit.exe"
sRegCmd = sRegCmd & " /s """ & oUtility.ScriptDir & "\Configs\AFR_Settings.reg"""
'oShell.Run(sRegCmd, 0, true)
oUtility.RunWithConsoleLogging sRegCmd
oFSO.CopyFile (oUtility.ScriptDir & "\Configs\ADMX\90meter CACPIVMD DoD Policies.admx"), ("C:\Windows\PolicyDefinitions\90meter CACPIVMD DoD Policies.admx"), True
oFSO.CopyFile (oUtility.ScriptDir & "\Configs\ADMX\90meter CACPIVMD Policies.admx"), ("C:\Windows\PolicyDefinitions\90meter CACPIVMD Policies.admx"), True
oFSO.CopyFile (oUtility.ScriptDir & "\Configs\ADMX\en-US\90meter CACPIVMD DoD Policies.adml"), ("C:\Windows\PolicyDefinitions\en-US\90meter CACPIVMD DoD Policies.adml"), True
oFSO.CopyFile (oUtility.ScriptDir & "\Configs\ADMX\en-US\90meter CACPIVMD Policies.adml"), ("C:\Windows\PolicyDefinitions\en-US\90meter CACPIVMD Policies.adml"), True
oLogging.CreateEntry "Policy Configurations files were copied to ""C:\Windows\PolicyDefinitions"" folder", LogTypeInfo
oLogging.CreateEntry "Finished " & sInstallName & " installation", LogTypeInfo
Else
ZTIProcess = Failure
oLogging.CreateEntry sInstallName & " installation failed with exit code = " & iRetVal, LogTypeError
End If
'// Enable Zone Checks
oEnv.Remove("SEE_MASK_NOZONECHECKS")
End Function
Function DeleteFile(sPath, sName)
On error resume next
Dim strFullPath
strFullPath = sPath & "\" & sName
If oFSO.fileexists(strFullPath) Then
oLogging.CreateEntry "File Found: " & strFullPath, LogTypeInfo
oFSO.DeleteFile strFullPath,0
oLogging.CreateEntry "File Deleted: " & strFullPath, LogTypeInfo
Else
oLogging.CreateEntry "File Not Found: " & strFullPath & ", skipping", LogTypeInfo
End If
End Function
</script>
</job>