-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathInstall-AdminMenu.wsf
184 lines (133 loc) · 4.95 KB
/
Install-AdminMenu.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
<job id="Install-AdminMenu">
<script language="VBScript" src="..\..\scripts\ZTIUtility.vbs"/>
<script language="VBScript">
' //----------------------------------------------------------------------------
' //
' // Solution: Richard's Deployment Script
' // File: Install-AdminMenu.wsf
' //
' // Purpose: This will install Powershellcrack Admin Run-As Menu
' //
' // Author: Richard Tracy
' //
' // Usage: cscript Install-AdminMenu.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 sInstallName, sInstallerPath
Dim sType
Dim bUseNetConfigs,sNetConfigPath
Dim colorArgs
Dim xmlDoc, objNode
Dim sLocalConfigFile
'// 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 = oUtility.Arguments("arch")
ElseIf oEnvironment.Exists("Architecture") Then
sArch = oEnvironment.Item("Architecture")
Else
sArch = "x86"
End If
'// Variables:
'// Change if needed
sVersion = "3.9.9.3"
sType = "no executable"
sFile = "Admin Run-As Menu " & sVersion & " (" & sType & ").exe"
'Get Color Arguments
If oUtility.Arguments.Exists("color") Then
colorArgs = oUtility.Arguments("color")
Else
colorArgs = "Blue"
End If
'Apply Settings.
If oUtility.Arguments.Exists("configpath") Then
bUseNetConfigs = True
sNetConfigPath = oUtility.Arguments("configpath")
Else
bUseNetConfigs = False
sNetConfigPath = "\\server\share"
End If
If sArch = "x64" then
sLocalConfigFile = "C:\Program Files\Admin Run-As Menu\AdminMenu.ps1.config"
Else
sLocalConfigFile = "C:\Program Files (x86)\Admin Run-As Menu\AdminMenu.ps1.config"
End If
sInstallName = "Powershellcrack Run-As AdminMenu"
sInstallerPath = oUtility.ScriptDir & "\Source\" & sFile
'// 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
'Install Horizon View Client
iRetVal = oUtility.RunWithHeartbeat("""" & sInstallerPath & """ /VERYSILENT")
if (iRetVal = 0) or (iRetVal = 3010) then
ZTIProcess = Success
oLogging.CreateEntry "Finished Powershellcrack AdminMenu installation", LogTypeInfo
oLogging.CreateEntry "Editing configuration file: " & sLocalConfigFile, LogTypeInfo
' Path to your xml file
' Create an xml Documment object and load your file
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Async = "False"
xmlDoc.Load sLocalConfigFile
' Find the AdminMenu_Configs/Menu_Options/Option_Accent
Set objNode = xmlDoc.SelectSingleNode("//AdminMenu_Configs/Menu_Options/Option_Accent")
' Test that a node was returned
If Not objNode Is Nothing Then
objNode.Text = colorArgs
oLogging.CreateEntry "Changed color to: " & colorArgs, LogTypeVerbose
End If
If bUseNetConfigs Then
' Find the AdminMenu_Configs/Menu_Configs/Config_UseRemote
Set objNode = xmlDoc.SelectSingleNode("//AdminMenu_Configs/Menu_Configs/Config_UseRemote")
' Test that a node was returned
If Not objNode Is Nothing Then
objNode.Text = "True"
oLogging.CreateEntry "Enabled remote files", LogTypeVerbose
End If
' Find the AdminMenu_Configs/Menu_Configs/Config_RemotePath
Set objNode = xmlDoc.SelectSingleNode("//AdminMenu_Configs/Menu_Configs/Config_RemotePath")
' Test that a node was returned
If Not objNode Is Nothing Then
objNode.Text = sNetConfigPath
oLogging.CreateEntry "Changed net path to: " & sNetConfigPath, LogTypeVerbose
End If
End If
' Save the changes
xmlDoc.Save sLocalConfigFile
' Clean up
If Not objNode Is Nothing Then
Set objNode = Nothing
End If
Set xmlDoc = Nothing
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
</script>
</job>