-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.vb
281 lines (235 loc) · 10.5 KB
/
Form1.vb
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
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
Imports System.Net
Imports System.Net.Mail
Imports System.Threading
Imports System.Management
Public Class Form1
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Timer1.Enabled = False
Timer1.Stop()
Timer2.Enabled = True
Timer2.Start()
PictureBox2.Visible = True
Label3.Visible = True
GetSpiceWorksVersion()
GetPDFCreatorVersion()
GetBluebeamVersion()
GetWatchtowerCadVersion()
GetWindowsOSVersion()
GetWindowsOSBuildVersion()
GetPowerBIDesktopVersion()
End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
Timer2.Enabled = False
Timer2.Stop()
PictureBox3.Visible = True
Label4.Visible = True
InstallSpiceworks.Enabled = True
InstallSpiceworks.Start()
Timer3.Enabled = True
Timer3.Start()
End Sub
Private Sub Timer3_Tick(sender As Object, e As EventArgs) Handles Timer3.Tick
Timer3.Enabled = False
Timer3.Stop()
PictureBox4.Visible = True
Label5.Visible = True
Timer4.Enabled = True
Timer4.Start()
End Sub
Private Sub Timer5_Tick(sender As Object, e As EventArgs) Handles Timer5.Tick
Timer5.Enabled = False
Timer5.Stop()
PictureBox5.Visible = True
Label6.Visible = True
Main.Show()
Me.Hide()
End Sub
Private Sub Timer4_Tick(sender As Object, e As EventArgs) Handles Timer4.Tick
Timer4.Enabled = False
Timer4.Stop()
PictureBox5.Visible = True
Label6.Visible = True
PictureBox4.Visible = True
Label5.Visible = True
Timer5.Enabled = True
Timer5.Start()
End Sub
Dim PDFCreatorVersionChecked As Boolean = False
Dim BluebeamVersionChecked As Boolean = False
Dim WatchtowerCadVersionChecked As Boolean = False
Dim WindowsOSVersionChecked As Boolean = False
Dim WindowsOSBuildVersionChecked As Boolean = False
Dim pdfcreatorversion As String
Dim bluebeamversion As String
Dim watchtowercadversion As String
Dim windowsosversion As String
Dim windowsosbuildversion As String
Dim powerbidesktop As String
Dim powerbidesktopchecked As Boolean = False
Dim spiceworksversion As String
Private Sub GetSpiceWorksVersion()
Try
If My.Computer.FileSystem.FileExists("C:\Zone6HelpDesk\Spiceworks.txt") Then
spiceworksversion = My.Computer.FileSystem.ReadAllText("C:\Zone6Helpdesk\Spiceworks.txt")
If spiceworksversion <> "" Then
Dim nonNumericCharacters As New System.Text.RegularExpressions.Regex("[^0-9.]")
Dim numericOnlyString As String = nonNumericCharacters.Replace(spiceworksversion, String.Empty)
spiceworksversion = numericOnlyString
'SpiceworksVersionLabel.Text = spiceworksversion
'SpiceworksVersionLabel.Visible = True
End If
End If
Catch ex As Exception
End Try
End Sub
Private Sub GetPowerBIDesktopVersion()
Try
If My.Computer.FileSystem.FileExists("C:\Zone6Helpdesk\PowerBIDesktop.txt") Then
powerbidesktopchecked = True
powerbidesktop = My.Computer.FileSystem.ReadAllText("C:\Zone6Helpdesk\PowerBIDesktop.txt")
If powerbidesktop <> "" Then
powerbidesktop = "Installed"
'PowerBiColor.Visible = True
Else
powerbidesktop = "Not Installed"
'PowerBIGray.Visible = True
End If
End If
Catch ex As Exception
End Try
End Sub
Private Sub GetWindowsOSBuildVersion()
Try
If My.Computer.FileSystem.FileExists("C:\Zone6Helpdesk\WindowsBuildNumber.txt") Then
WindowsOSBuildVersionChecked = True
windowsosbuildversion = My.Computer.FileSystem.ReadAllText("C:\Zone6Helpdesk\WindowsBuildNumber.txt")
End If
Catch ex As Exception
End Try
End Sub
Private Sub GetWindowsOSVersion()
Try
If My.Computer.FileSystem.FileExists("C:\Zone6Helpdesk\WindowsOS.txt") Then
WindowsOSVersionChecked = True
windowsosversion = My.Computer.FileSystem.ReadAllText("C:\Zone6Helpdesk\WindowsOS.txt")
End If
Catch ex As Exception
End Try
End Sub
Private Sub GetPDFCreatorVersion()
Try
If My.Computer.FileSystem.FileExists("C:\Zone6Helpdesk\PDFCreator.txt") Then
PDFCreatorVersionChecked = True
pdfcreatorversion = My.Computer.FileSystem.ReadAllText("C:\Zone6Helpdesk\PDFCreator.txt")
If pdfcreatorversion = "" Then
'PDFCreatorGray.Visible = True
'PDFCreatorColor.Visible = False
Else
'PDFCreatorColor.Visible = True
'PDFCreatorGray.Visible = False
Dim nonNumericCharacters As New System.Text.RegularExpressions.Regex("[^0-9.]")
Dim numericOnlyString As String = nonNumericCharacters.Replace(pdfcreatorversion, String.Empty)
pdfcreatorversion = numericOnlyString
'PDFCreatorVersionLabel.Text = pdfcreatorversion
'PDFCreatorVersionLabel.Visible = True
End If
End If
Catch ex As Exception
End Try
End Sub
Private Sub GetBluebeamVersion()
Try
If My.Computer.FileSystem.FileExists("C:\Zone6Helpdesk\Bluebeam.txt") Then
BluebeamVersionChecked = True
bluebeamversion = My.Computer.FileSystem.ReadAllText("C:\Zone6Helpdesk\Bluebeam.txt")
If bluebeamversion = "" Then
'BlueBeamGray.Visible = True
'BlueBeamColor.Visible = False
Else
'BlueBeamGray.Visible = False
'BlueBeamColor.Visible = True
Dim nonNumericCharacters As New System.Text.RegularExpressions.Regex("[^0-9.]")
Dim numericOnlyString As String = nonNumericCharacters.Replace(bluebeamversion, String.Empty)
bluebeamversion = numericOnlyString
'BlueBeamVersionLabel.Text = bluebeamversion
'BlueBeamVersionLabel.Visible = True
End If
End If
Catch ex As Exception
End Try
End Sub
Private Sub GetWatchtowerCadVersion()
Try
If My.Computer.FileSystem.FileExists("C:\Zone6Helpdesk\WatchtowerCad.txt") Then
watchtowercadversion = My.Computer.FileSystem.ReadAllText("C:\Zone6Helpdesk\WatchtowerCad.txt")
If watchtowercadversion = "" Then
'WTCadGray.Visible = True
'WTCadColor.Visible = False
Else
'WTCadColor.Visible = True
'WTCadGray.Visible = False
Dim nonNumericCharacters As New System.Text.RegularExpressions.Regex("[^0-9]")
Dim numericOnlyString As String = nonNumericCharacters.Replace(watchtowercadversion, String.Empty)
watchtowercadversion = numericOnlyString
'WTCadVersionLabel.Text = watchtowercadversion
'WTCadVersionLabel.Visible = True
End If
End If
Catch ex As Exception
End Try
End Sub
Public Function IsProcessRunning(ByVal name As String) As Boolean
For Each clsProcess As Process In Process.GetProcesses()
If clsProcess.ProcessName.StartsWith(name) Then
Return True
End If
Next
Return False
End Function
Dim SpiceworksInstalled As Boolean = False
Dim timerrunning As Boolean = True
Private Sub InstallSpiceworks_Tick(sender As Object, e As EventArgs) Handles InstallSpiceworks.Tick
InstallSpiceworks.Stop()
InstallSpiceworks.Enabled = False
If Not My.Computer.FileSystem.DirectoryExists("C:\Zone6HelpDesk") Then
My.Computer.FileSystem.CreateDirectory("C:\Zone6HelpDesk")
End If
Try
'Dim remoteUri As String = "http://download.spiceworks.com/Platform-Tools/current/Spiceworks%20TLS%20Agent.msi"
'Dim fileName As String = "C:\Zone6HelpDesk\Spiceworks.msi"
'Dim password As String = "..."
'Dim username As String = "..."
'Using client As New WebClient()
' client.DownloadFile(remoteUri, fileName)
'End Using
If Not My.Computer.FileSystem.FileExists("C:\Zone6HelpDesk\Spiceworks.msi") Then My.Computer.Network.DownloadFile("http://ldc.prestonbarnes.com/Spiceworks.msi", "C:\Zone6HelpDesk\Spiceworks.msi")
Dim s As String
s = "msiexec.exe /qn /i ""C:\Zone6HelpDesk\Spiceworks.msi"" SPICEWORKS_SERVER=""zone6helpdesk.mykeyauto.com"" SPICEWORKS_PORT=""443"" SPICEWORKS_AUTH_KEY=""YHmBSOeFxHVhrgE96LbVcyNMGEI="" ADDLOCAL=""FeatureService"""
Shell(s, AppWinStyle.NormalFocus)
SpiceworksInstalled = True
Catch ex As Exception
MsgBox("Can't download file")
End Try
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
End Sub
'Declare the variables
Dim drag As Boolean
Dim mousex As Integer
Dim mousey As Integer
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
drag = True 'Sets the variable drag to true.
mousex = Windows.Forms.Cursor.Position.X - Me.Left 'Sets variable mousex
mousey = Windows.Forms.Cursor.Position.Y - Me.Top 'Sets variable mousey
End Sub
Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
'If drag is set to true then move the form accordingly.
If drag Then
Me.Top = Windows.Forms.Cursor.Position.Y - mousey
Me.Left = Windows.Forms.Cursor.Position.X - mousex
End If
End Sub
Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
drag = False 'Sets drag to false, so the form does not move according to the code in MouseMove
End Sub
End Class