SHOW:
|
|
- or go back to the newest paste.
1 | ' https://twitter.com/waleedassar | |
2 | ' http://waliedassar.com/ | |
3 | ' Simple WMI WQL queries for detecting VirtualBox VM's | |
4 | VBoxFound = False | |
5 | ||
6 | set objX = GetObject("winmgmts:\\.\root\cimv2") | |
7 | ||
8 | ' Win32_NetworkAdapterConfiguration aka NICCONFIG | |
9 | Set NicQ = objX.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration") | |
10 | For Each Nic in NicQ | |
11 | if Not IsNull(Nic.MACAddress) And Not IsNull(Nic.Description) Then | |
12 | MacAddress = LCase(CStr(Nic.MACAddress)) | |
13 | Description = LCase(CStr(Nic.Description)) | |
14 | 'We want to detect the VirtualBox guest, not the host | |
15 | If InStr(1,MacAddress,"08:00:27:") = 1 And InStr(1,Description,"virtualbox") = 0 Then | |
16 | WScript.Echo "Win32_NetworkAdapterConfiguration ==> Nic.MACAddress: " & Nic.MACAddress | |
17 | VBoxFound = True | |
18 | End If | |
19 | End If | |
20 | Next | |
21 | ||
22 | 'Win32_SystemDriver aka sysdriver | |
23 | Set SySDrvQ = objX.ExecQuery("SELECT * FROM Win32_SystemDriver") | |
24 | For Each SysDrv in SysDrvQ | |
25 | DescSysDrv = SysDrv.Description | |
26 | DispSysDrv = SysDrv.DisplayName | |
27 | NameSysDrv = SysDrv.Name | |
28 | PathSysDrv = SysDrv.PathName | |
29 | If Not IsNull(DescSysDrv) Then | |
30 | If DescSysDrv = "VirtualBox Guest Driver" Or DescSysDrv = "VirtualBox Guest Mouse Service" Or DescSysDrv = "VirtualBox Shared Folders" Or DescSysDrv = "VBoxVideo" Then | |
31 | WScript.Echo "Win32_SystemDriver ==> SysDrv.Description ==> " & DescSysDrv | |
32 | VBoxFound = True | |
33 | End If | |
34 | End If | |
35 | ||
36 | If Not IsNull(DispSysDrv) Then | |
37 | If DispSysDrv = "VirtualBox Guest Driver" Or DispSysDrv = "VirtualBox Guest Mouse Service" Or DispSysDrv = "VirtualBox Shared Folders" Or DispSysDrv = "VBoxVideo" Then | |
38 | WScript.Echo "Win32_SystemDriver ==> SysDrv.DisplayName ==> " & DispSysDrv | |
39 | VBoxFound = True | |
40 | End If | |
41 | End If | |
42 | ||
43 | If Not IsNull(NameSysDrv) Then | |
44 | If NameSysDrv = "VBoxGuest" Or NameSysDrv = "VBoxMouse" Or NameSysDrv = "VBoxSF" Or NameSysDrv = "VBoxVideo" Then | |
45 | WScript.Echo "Win32_SystemDriver ==> SysDrv.Name ==> " & NameSysDrv | |
46 | VBoxFound = True | |
47 | End If | |
48 | End If | |
49 | ||
50 | If Not IsNull(PathSysDrv) Then | |
51 | PathSysDrv_l = LCase(PathSysDrv) | |
52 | If InStr(1,PathSysDrv_l,"vboxguest.sys") > 0 Or InStr(1,PathSysDrv_l,"vboxmouse.sys") > 0 Or InStr(1,PathSysDrv_l,"vboxsf.sys") > 0 Or InStr(1,PathSysDrv_l,"vboxvideo.sys") > 0 Then | |
53 | WScript.Echo "Win32_SystemDriver ==> SysDrv.PathName ==> " & PathSysDrv | |
54 | VBoxFound = True | |
55 | End If | |
56 | End If | |
57 | Next | |
58 | ||
59 | ' Win32_NTEventLog aka NTEventLog | |
60 | Set EvtLogQ = objX.ExecQuery("SELECT * FROM Win32_NTEventlogFile") | |
61 | For Each EvtLogX In EvtLogQ | |
62 | If Not IsNull(EvtLogX) Then | |
63 | FileNameEvtX = CStr(EvtLogX.FileName) | |
64 | FileNameEvtX_l = LCase(FileNameEvtX) | |
65 | If FileNameEvtX_l = "sysevent" Or FileNameEvtX_l = "system" Then | |
66 | SourcesEvtX = EvtLogX.Sources | |
67 | For Each SourceEvtX in SourcesEvtX | |
68 | SourceEvtX_l = LCase(CStr(SourceEvtX)) | |
69 | If SourceEvtX_l = "vboxvideo" Then | |
70 | WScript.Echo "Win32_NTEventlogFile ==> EvtLogX.Sources ==> " & SourceEvtX | |
71 | VBoxFound = True | |
72 | End If | |
73 | Next | |
74 | End If | |
75 | End If | |
76 | Next | |
77 | ||
78 | ' Win32_BIOS aka bios | |
79 | Set BiosQ = objX.ExecQuery("SELECT * FROM Win32_BIOS") | |
80 | For Each Bios in BiosQ | |
81 | If Not IsNull(Bios) Then | |
82 | If Not IsNull(Bios.Manufacturer) Then | |
83 | ManufacturerBios = LCase(CStr(Bios.Manufacturer)) | |
84 | If InStr(1,ManufacturerBios,"innotek gmbh") > 0 Then | |
85 | WScript.Echo "Win32_BIOS ==> Bios.Manufacturer ==> " & Bios.Manufacturer | |
86 | VBoxFound = True | |
87 | End If | |
88 | End If | |
89 | If Not IsNull(Bios.SMBIOSBIOSVersion) Then | |
90 | SMBIOSBIOSVersionBios = LCase(CStr(Bios.SMBIOSBIOSVersion)) | |
91 | If InStr(1,SMBIOSBIOSVersionBios,"virtualbox") > 0 Then | |
92 | WScript.Echo "Win32_BIOS ==> Bios.SMBIOSBIOSVersion ==> " & Bios.SMBIOSBIOSVersion | |
93 | VBoxFound = True | |
94 | End If | |
95 | End If | |
96 | If Not IsNull(Bios.Version) Then | |
97 | VersionBios = LCase(CStr(Bios.Version)) | |
98 | If InStr(1,VersionBios,"vbox - 1") > 0 Then | |
99 | WScript.Echo "Win32_BIOS ==> Bios.Version ==> " & Bios.Version | |
100 | VBoxFound = True | |
101 | End If | |
102 | End If | |
103 | End If | |
104 | Next | |
105 | ||
106 | ' Win32_DiskDrive aka diskdrive | |
107 | Set DiskDriveQ = objX.ExecQuery("SELECT * FROM Win32_DiskDrive") | |
108 | For Each DiskDrive in DiskDriveQ | |
109 | If Not IsNull(DiskDrive) Then | |
110 | If Not IsNull(DiskDrive.Model) Then | |
111 | ModelDskDrv = LCase(DiskDrive.Model) | |
112 | If ModelDskDrv = "vbox harddisk" Then | |
113 | WScript.Echo "Win32_DiskDrive ==> DiskDrive.Model ==> " & DiskDrive.Model | |
114 | VBoxFound = True | |
115 | End If | |
116 | End If | |
117 | If Not IsNull(DiskDrive.PNPDeviceID) Then | |
118 | PNPDeviceIDDskDrv = LCase(DiskDrive.PNPDeviceID) | |
119 | If InStr(1,PNPDeviceIDDskDrv,"diskvbox") > 0 Then | |
120 | WScript.Echo "Win32_DiskDrive ==> DiskDrive.PNPDeviceID ==> " & DiskDrive.PNPDeviceID | |
121 | VBoxFound = True | |
122 | End If | |
123 | End If | |
124 | End If | |
125 | Next | |
126 | ||
127 | ' Win32_StartupCommand aka Startup | |
128 | Set StartupQ = objX.ExecQuery("SELECT * FROM Win32_StartupCommand") | |
129 | For Each Startup in StartupQ | |
130 | If Not IsNull(Startup) Then | |
131 | If Not IsNull(Startup.Caption) Then | |
132 | CaptionStartup = LCase(CStr(Startup.Caption)) | |
133 | If CaptionStartup = "vboxtray" Then | |
134 | WScript.Echo "Win32_StartupCommand ==> Startup.Caption ==> " & Startup.Caption | |
135 | VBoxFound = True | |
136 | End If | |
137 | End If | |
138 | If Not IsNull(Startup.Command) Then | |
139 | CommandStartup = LCase(CStr(Startup.Command)) | |
140 | If InStr(1,CommandStartup,"vboxtray.exe") > 0 Then | |
141 | WScript.Echo "Win32_StartupCommand ==> Startup.Command ==> " & Startup.Command | |
142 | VBoxFound = True | |
143 | End If | |
144 | End If | |
145 | If Not IsNull(Startup.Description) Then | |
146 | DescStartup = LCase(CStr(Startup.Description)) | |
147 | If DescStartup = "vboxtray" Then | |
148 | WScript.Echo "Win32_StartupCommand ==> Startup.Description ==> " & Startup.Description | |
149 | VBoxFound = True | |
150 | End If | |
151 | End If | |
152 | End If | |
153 | Next | |
154 | ||
155 | 'Win32_ComputerSystem aka ComputerSystem | |
156 | Set ComputerSystemQ = objX.ExecQuery("SELECT * FROM Win32_ComputerSystem") | |
157 | For Each ComputerSystem in ComputerSystemQ | |
158 | If Not IsNull(ComputerSystem) Then | |
159 | If Not IsNull(ComputerSystem.Manufacturer) Then | |
160 | ManufacturerComputerSystem = LCase(CStr(ComputerSystem.Manufacturer)) | |
161 | If ManufacturerComputerSystem = "innotek gmbh" Then | |
162 | WScript.Echo "Win32_ComputerSystem ==> ComputerSystem.Manufacturer ==> " & ComputerSystem.Manufacturer | |
163 | VBoxFound = True | |
164 | End If | |
165 | End If | |
166 | If Not IsNull(ComputerSystem.Model) Then | |
167 | ModelComputerSystem = LCase(CStr(ComputerSystem.Model)) | |
168 | If ModelComputerSystem = "virtualbox" Then | |
169 | WScript.Echo "Win32_ComputerSystem ==> ComputerSystem.Model ==> " & ComputerSystem.Model | |
170 | VBoxFound = True | |
171 | End If | |
172 | End If | |
173 | If Not IsNull(ComputerSystem.OEMStringArray) Then | |
174 | OEMStringArrayComputerSystem = ComputerSystem.OEMStringArray | |
175 | For Each OEM In OEMStringArrayComputerSystem | |
176 | OEM_l = LCase(OEM) | |
177 | If InStr(1,OEM_l,"vboxver_") > 0 Or InStr(1,OEM_l,"vboxrev_") > 0 Then | |
178 | WScript.Echo "Win32_ComputerSystem ==> ComputerSystem.OEMStringArray ==> " & OEM | |
179 | VBoxFound = True | |
180 | End If | |
181 | Next | |
182 | End If | |
183 | End If | |
184 | Next | |
185 | ||
186 | 'Win32_Service aka service | |
187 | Set ServiceQ = objX.ExecQuery("SELECT * FROM Win32_Service") | |
188 | For Each Service in ServiceQ | |
189 | If Not IsNull(Service) Then | |
190 | If Not IsNull(Service.Caption) Then | |
191 | CaptionService = LCase(CStr(Service.Caption)) | |
192 | If CaptionService = "virtualbox guest additions service" Then | |
193 | WScript.Echo "Win32_Service ==> Service.Caption ==> " & Service.Caption | |
194 | VBoxFound = True | |
195 | End If | |
196 | End If | |
197 | If Not IsNull(Service.DisplayName) Then | |
198 | DisplayNameService = LCase(CStr(Service.DisplayName)) | |
199 | If DisplayNameService = "virtualbox guest additions service" Then | |
200 | WScript.Echo "Win32_Service ==> Service.DisplayName ==> " & Service.DisplayName | |
201 | VBoxFound = True | |
202 | End If | |
203 | End If | |
204 | If Not IsNull(Service.Name) Then | |
205 | NameService = LCase(CStr(Service.Name)) | |
206 | If NameService = "vboxservice" Then | |
207 | WScript.Echo "Win32_Service ==> Service.Name ==> " & Service.Name | |
208 | VBoxFound = True | |
209 | End If | |
210 | End If | |
211 | If Not IsNull(Service.PathName) Then | |
212 | PathNameService = LCase(CStr(Service.PathName)) | |
213 | If InStr(1,PathNameService,"vboxservice.exe") > 0 Then | |
214 | WScript.Echo "Win32_Service ==> Service.PathName ==> " & Service.PathName | |
215 | VBoxFound = True | |
216 | End If | |
217 | End If | |
218 | End If | |
219 | Next | |
220 | ||
221 | ||
222 | 'Win32_LogicalDisk aka LogicalDisk | |
223 | Set LogicalDiskQ = objX.ExecQuery("SELECT * FROM Win32_LogicalDisk") | |
224 | For Each LogicalDisk in LogicalDiskQ | |
225 | If Not IsNull(LogicalDisk) Then | |
226 | If Not IsNull(LogicalDisk.DriveType) Then | |
227 | If LogicalDisk.DriveType = 3 Then | |
228 | If Not IsNull(LogicalDisk.VolumeSerialNumber) Then | |
229 | VolumeSerialNumberLogicalDisk = LCase(LogicalDisk.VolumeSerialNumber) | |
230 | If VolumeSerialNumberLogicalDisk = "fceae0a3" Then | |
231 | WScript.Echo "Win32_LogicalDisk ==> LogicalDisk.VolumeSerialNumber ==> " & LogicalDisk.VolumeSerialNumber | |
232 | VBoxFound = True | |
233 | End If | |
234 | End If | |
235 | ElseIf LogicalDisk.DriveType = 5 Then | |
236 | If Not IsNull(LogicalDisk.VolumeName) Then | |
237 | VolumeNameLogicalDisk = LCase(LogicalDisk.VolumeName) | |
238 | 'Volume name should be "VBOXADDITIONS_4." | |
239 | If InStr(1,VolumeNameLogicalDisk,"vboxadditions") > 0 Then | |
240 | WScript.Echo "Win32_LogicalDisk ==> LogicalDisk.VolumeName ==> " & LogicalDisk.VolumeName | |
241 | VBoxFound = True | |
242 | End If | |
243 | End If | |
244 | End If | |
245 | End If | |
246 | End If | |
247 | Next | |
248 | ||
249 | 'Win32_LocalProgramGroup | |
250 | Set LogicalProgramGroupQ = objX.ExecQuery("SELECT * FROM Win32_LogicalProgramGroup") | |
251 | For Each LocalProgramGroup in LogicalProgramGroupQ | |
252 | If Not IsNull(LocalProgramGroup) Then | |
253 | NameLocalProgramGroup = LCase(LocalProgramGroup.Name) | |
254 | If InStr(1,NameLocalProgramGroup,"oracle vm virtualbox guest additions") > 0 Then | |
255 | WScript.Echo "Win32_LogicalProgramGroup ==> LocalProgramGroup.Name ==> " & LocalProgramGroup.Name | |
256 | VBoxFound = True | |
257 | End If | |
258 | End If | |
259 | Next | |
260 | ||
261 | ||
262 | ||
263 | 'Win32_NetworkAdapter aka NIC | |
264 | Set NicQQ = objX.ExecQuery("SELECT * FROM Win32_NetworkAdapter") | |
265 | For Each NIC_x in NicQQ | |
266 | if Not IsNull(NIC_x.MACAddress) And Not IsNull(NIC_x.Description) Then | |
267 | MacAddress_x = LCase(CStr(NIC_x.MACAddress)) | |
268 | Description_x = LCase(CStr(NIC_x.Description)) | |
269 | 'We want to detect the VirtualBox guest, not the host | |
270 | If InStr(1,MacAddress_x,"08:00:27:") = 1 And InStr(1,Description_x,"virtualbox") = 0 Then | |
271 | WScript.Echo "Wow: Win32_NetworkAdapter ==> NIC.MacAddress: " & NIC_x.MACAddress | |
272 | VBoxFound = True | |
273 | End If | |
274 | End If | |
275 | Next | |
276 | ||
277 | ||
278 | 'Win32_Process aka process | |
279 | Set ProcessQ = objX.ExecQuery("SELECT * FROM Win32_Process") | |
280 | For Each Process in ProcessQ | |
281 | If Not IsNull(Process) Then | |
282 | If Not IsNull(Process.Description) Then | |
283 | DescProcess = LCase(Process.Description) | |
284 | If DescProcess = "vboxservice.exe" Or DescProcess = "vboxtray.exe" Then | |
285 | WScript.Echo "Win32_Process ==> Process.Description ==> " & Process.Description | |
286 | VBoxFound = True | |
287 | End If | |
288 | End If | |
289 | If Not IsNull(Process.Name) Then | |
290 | NameProcess = LCase(Process.Name) | |
291 | If NameProcess = "vboxservice.exe" Or NameProcess = "vboxtray.exe" Then | |
292 | WScript.Echo "Win32_Process ==> Process.Name ==> " & Process.Name | |
293 | VBoxFound = True | |
294 | End If | |
295 | End If | |
296 | If Not IsNull(Process.CommandLine) Then | |
297 | CmdProcess = LCase(Process.CommandLine) | |
298 | If InStr(1,CmdProcess,"vboxservice.exe") > 0 OR InStr(1,CmdProcess,"vboxtray.exe") > 0 Then | |
299 | WScript.Echo "Win32_Service ==> Process.CommandLine ==> " & Process.CommandLine | |
300 | VBoxFound = True | |
301 | End If | |
302 | End If | |
303 | If Not IsNull(Process.ExecutablePath) Then | |
304 | ExePathProcess = LCase(Process.ExecutablePath) | |
305 | If InStr(1,ExePathProcess,"vboxservice.exe") > 0 OR InStr(1,ExePathProcess,"vboxtray.exe") > 0 Then | |
306 | WScript.Echo "Win32_Service ==> Process.ExecutablePath ==> " & Process.ExecutablePath | |
307 | VBoxFound = True | |
308 | End If | |
309 | End If | |
310 | End If | |
311 | Next | |
312 | ||
313 | 'Win32_BaseBoard aka BaseBoard | |
314 | Set BaseBoardQ = objX.ExecQuery("SELECT * FROM Win32_BaseBoard") | |
315 | For Each BaseBoard in BaseBoardQ | |
316 | If Not IsNull(BaseBoard) Then | |
317 | If Not IsNull(BaseBoard.Manufacturer) Then | |
318 | ManufacturerBaseBoard = LCase(BaseBoard.Manufacturer) | |
319 | If ManufacturerBaseBoard = "oracle corporation" Then | |
320 | WScript.Echo "Win32_BaseBoard ==> BaseBoard.Manufacturer ==> " & BaseBoard.Manufacturer | |
321 | VBoxFound = True | |
322 | End If | |
323 | End If | |
324 | If Not IsNull(BaseBoard.Product) Then | |
325 | ProductBaseBoard = LCase(BaseBoard.Product) | |
326 | If ProductBaseBoard = "virtualbox" Then | |
327 | WScript.Echo "Win32_BaseBoard ==> BaseBoard.Product ==> " & BaseBoard.Product | |
328 | VBoxFound = True | |
329 | End If | |
330 | End If | |
331 | End If | |
332 | Next | |
333 | ||
334 | 'Win32_SystemEnclosure aka SystemEnclosure | |
335 | Set SystemEnclosureQ = objX.ExecQuery("SELECT * FROM Win32_SystemEnclosure") | |
336 | For Each SystemEnclosure in SystemEnclosureQ | |
337 | If Not IsNull(SystemEnclosure) Then | |
338 | If Not IsNull(SystemEnclosure.Manufacturer) Then | |
339 | ManufacturerSystemEnclosure = LCase(SystemEnclosure.Manufacturer) | |
340 | If ManufacturerSystemEnclosure = "oracle corporation" Then | |
341 | WScript.Echo "Win32_SystemEnclosure ==> SystemEnclosure.Manufacturer ==> " & SystemEnclosure.Manufacturer | |
342 | VBoxFound = True | |
343 | End If | |
344 | End If | |
345 | End If | |
346 | Next | |
347 | ||
348 | 'Win32_CDROMDrive aka cdrom | |
349 | Set CDRomQ = objX.ExecQuery("SELECT * FROM Win32_CDROMDrive") | |
350 | For Each CDRom in CDRomQ | |
351 | If Not IsNull(CDRom) Then | |
352 | If Not IsNull(CDRom.Name) Then | |
353 | NameCDRom = LCase(CDRom.Name) | |
354 | If NameCDRom = "vbox cd-rom" Then | |
355 | WScript.Echo "Win32_CDROMDrive ==> CDRom.Name ==> " & CDRom.Name | |
356 | VBoxFound = True | |
357 | End If | |
358 | End If | |
359 | If Not IsNull(CDRom.VolumeName) Then | |
360 | VolumeNameCDRom = LCase(CDRom.VolumeName) | |
361 | 'Volume name should be "VBOXADDITIONS_4." | |
362 | If InStr(1,VolumeNameCDRom,"vboxadditions") > 0 Then | |
363 | WScript.Echo "Win32_CDROMDrive ==> CDRom.VolumeName ==> " & CDRom.VolumeName | |
364 | VBoxFound = True | |
365 | End If | |
366 | End If | |
367 | If Not IsNull(CDRom.DeviceID) Then | |
368 | DeviceIDCDRom = LCase(CDRom.DeviceID) | |
369 | If InStr(1,DeviceIDCDRom,"cdromvbox") > 0 Then | |
370 | WScript.Echo "Win32_CDROMDrive ==> CDRom.DeviceID ==> " & CDRom.DeviceID | |
371 | VBoxFound = True | |
372 | End If | |
373 | End If | |
374 | If Not IsNull(CDRom.PNPDeviceID) Then | |
375 | PNPDeviceIDCDRom = LCase(CDRom.PNPDeviceID) | |
376 | If InStr(1,PNPDeviceIDCDRom,"cdromvbox") > 0 Then | |
377 | WScript.Echo "Win32_CDROMDrive ==> CDRom.PNPDeviceID ==> " & CDRom.PNPDeviceID | |
378 | VBoxFound = True | |
379 | End If | |
380 | End If | |
381 | End If | |
382 | Next | |
383 | ||
384 | ||
385 | 'WIN32_NetworkClient aka netclient | |
386 | Set NetClientQ = objX.ExecQuery("SELECT * FROM WIN32_NetworkClient") | |
387 | For Each NetClient in NetClientQ | |
388 | If Not IsNull(NetClient) Then | |
389 | If Not IsNull(NetClient.Description) Then | |
390 | DescNetClient = LCase(NetClient.Description) | |
391 | If DescNetClient = "vboxsf" Then | |
392 | WScript.Echo "WIN32_NetworkClient ==> NetClient.Description ==> " & NetClient.Description | |
393 | VBoxFound = True | |
394 | End If | |
395 | End If | |
396 | If Not IsNull(NetClient.Manufacturer) Then | |
397 | ManufacturerNetClient = LCase(NetClient.Manufacturer) | |
398 | If ManufacturerNetClient = "oracle corporation" Then | |
399 | WScript.Echo "WIN32_NetworkClient ==> NetClient.Manufacturer ==> " & NetClient.Manufacturer | |
400 | VBoxFound = True | |
401 | End If | |
402 | End If | |
403 | If Not IsNull(NetClient.Name) Then | |
404 | NameNetClient = LCase(NetClient.Name) | |
405 | If NameNetClient = "virtualbox shared folders" Then | |
406 | WScript.Echo "WIN32_NetworkClient ==> NetClient.Name ==> " & NetClient.Name | |
407 | VBoxFound = True | |
408 | End If | |
409 | End If | |
410 | End If | |
411 | Next | |
412 | ||
413 | 'Win32_ComputerSystemProduct aka csproduct | |
414 | Set CSProductQ = objX.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct") | |
415 | For Each CSProduct in CSProductQ | |
416 | If Not IsNull(CSProduct) Then | |
417 | If Not IsNull(CSProduct.Name) Then | |
418 | NameCSProduct = LCase(CSProduct.Name) | |
419 | If NameCSProduct = "virtualbox" Then | |
420 | WScript.Echo "Win32_ComputerSystemProduct ==> CSProduct.Name ==> " & CSProduct.Name | |
421 | VBoxFound = True | |
422 | End If | |
423 | End If | |
424 | If Not IsNull(CSProduct.Vendor) Then | |
425 | VendorCSProduct = LCase(CSProduct.Vendor) | |
426 | If VendorCSProduct = "innotek gmbh" Then | |
427 | WScript.Echo "Win32_ComputerSystemProduct ==> CSProduct.Vendor ==> " & CSProduct.Vendor | |
428 | VBoxFound = True | |
429 | End If | |
430 | End If | |
431 | End If | |
432 | Next | |
433 | ||
434 | 'Win32_VideoController | |
435 | Set VideoControllerQ = objX.ExecQuery("SELECT * FROM Win32_VideoController") | |
436 | For Each VideoController in VideoControllerQ | |
437 | If Not IsNull(VideoController) Then | |
438 | If Not IsNull(VideoController.Name) Then | |
439 | NameVideoController = LCase(VideoController.Name) | |
440 | If NameVideoController = "virtualbox graphics adapter" Then | |
441 | WScript.Echo "Win32_VideoController ==> VideoController.Name ==> " & VideoController.Name | |
442 | VBoxFound = True | |
443 | End If | |
444 | End If | |
445 | If Not IsNull(VideoController.Description) Then | |
446 | DescVideoController = LCase(VideoController.Description) | |
447 | If DescVideoController = "virtualbox graphics adapter" Then | |
448 | WScript.Echo "Win32_VideoController ==> VideoController.Description ==> " & VideoController.Description | |
449 | VBoxFound = True | |
450 | End If | |
451 | End If | |
452 | If Not IsNull(VideoController.Caption) Then | |
453 | CaptionVideoController = LCase(VideoController.Caption) | |
454 | If CaptionVideoController = "virtualbox graphics adapter" Then | |
455 | WScript.Echo "Win32_VideoController ==> VideoController.Caption ==> " & VideoController.Caption | |
456 | VBoxFound = True | |
457 | End If | |
458 | End If | |
459 | If Not IsNull(VideoController.VideoProcessor) Then | |
460 | VideoProcessorVideoController = LCase(VideoController.VideoProcessor) | |
461 | If VideoProcessorVideoController = "vbox" Then | |
462 | WScript.Echo "Win32_VideoController ==> VideoController.VideoProcessor ==> " & VideoController.VideoProcessor | |
463 | VBoxFound = True | |
464 | End If | |
465 | End If | |
466 | If Not IsNull(VideoController.InstalledDisplayDrivers) Then | |
467 | InstalledDisplayDriversVideoController = LCase(VideoController.InstalledDisplayDrivers) | |
468 | If InstalledDisplayDriversVideoController = "vboxdisp.sys" Then | |
469 | WScript.Echo "Win32_VideoController ==> VideoController.InstalledDisplayDrivers ==> " & VideoController.InstalledDisplayDrivers | |
470 | VBoxFound = True | |
471 | End If | |
472 | End If | |
473 | If Not IsNull(VideoController.InfSection) Then | |
474 | InfSectionVideoController = LCase(VideoController.InfSection) | |
475 | If InfSectionVideoController = "vboxvideo" Then | |
476 | WScript.Echo "Win32_VideoController ==> VideoController.InfSection ==> " & VideoController.InfSection | |
477 | VBoxFound = True | |
478 | End If | |
479 | End If | |
480 | If Not IsNull(VideoController.AdapterCompatibility) Then | |
481 | AdapterCompatibilityVideoController = LCase(VideoController.AdapterCompatibility) | |
482 | If AdapterCompatibilityVideoController = "oracle corporation" Then | |
483 | WScript.Echo "Win32_VideoController ==> VideoController.AdapterCompatibility ==> " & VideoController.AdapterCompatibility | |
484 | VBoxFound = True | |
485 | End If | |
486 | End If | |
487 | End If | |
488 | Next | |
489 | ||
490 | ||
491 | 'Win32_PnPEntity | |
492 | Set PnPEntityQ = objX.ExecQuery("SELECT * FROM Win32_PnPEntity") | |
493 | For Each PnPEntity in PnPEntityQ | |
494 | If Not IsNull(PnPEntity) Then | |
495 | If Not IsNull(PnPEntity.Name) Then | |
496 | NamePnPEntity = LCase(PnPEntity.Name) | |
497 | If NamePnPEntity = "virtualbox device" Or NamePnPEntity = "vbox harddisk" Or NamePnPEntity = "vbox cd-rom" Or NamePnPEntity = "virtualbox graphics adapter" Then | |
498 | WScript.Echo "Win32_PnPEntity ==> PnPEntity.Name ==> " & PnPEntity.Name | |
499 | VBoxFound = True | |
500 | End If | |
501 | End If | |
502 | If Not IsNull(PnPEntity.Caption) Then | |
503 | CaptionPnPEntity = LCase(PnPEntity.Caption) | |
504 | If CaptionPnPEntity = "virtualbox device" Or CaptionPnPEntity = "vbox harddisk" Or CaptionPnPEntity = "vbox cd-rom" Or CaptionPnPEntity = "virtualbox graphics adapter" Then | |
505 | WScript.Echo "Win32_PnPEntity ==> PnPEntity.Caption ==> " & PnPEntity.Caption | |
506 | VBoxFound = True | |
507 | End If | |
508 | End If | |
509 | If Not IsNull(PnPEntity.Description) Then | |
510 | DescPnPEntity = LCase(PnPEntity.Description) | |
511 | If DescPnPEntity = "virtualbox device" Or DescPnPEntity = "virtualbox graphics adapter" Then | |
512 | WScript.Echo "Win32_PnPEntity ==> PnPEntity.Description ==> " & PnPEntity.Description | |
513 | VBoxFound = True | |
514 | End If | |
515 | End If | |
516 | 'Had to remove .Manufacturer as it detects Host as well | |
517 | 'If Not IsNull(PnPEntity.Manufacturer) Then | |
518 | 'ManuPnPEntity = LCase(PnPEntity.Manufacturer) | |
519 | 'If ManuPnPEntity = "oracle corporation" Then | |
520 | 'WScript.Echo "Win32_PnPEntity ==> PnPEntity.Manufacturer ==> " & PnPEntity.Manufacturer | |
521 | 'VBoxFound = True | |
522 | 'End If | |
523 | 'End If | |
524 | If Not IsNull(PnPEntity.Service) Then | |
525 | SrvPnPEntity = LCase(PnPEntity.Service) | |
526 | If SrvPnPEntity = "vboxguest" Or SrvPnPEntity = "vboxvideo" Then | |
527 | WScript.Echo "Win32_PnPEntity ==> PnPEntity.Service ==> " & PnPEntity.Service | |
528 | VBoxFound = True | |
529 | End If | |
530 | End If | |
531 | If Not IsNull(PnPEntity.DeviceID) Then | |
532 | DeviceIDPnPEntity = LCase(PnPEntity.DeviceID) | |
533 | If InStr(1,DeviceIDPnPEntity,"diskvbox_") > 0 Or InStr(1,DeviceIDPnPEntity,"cdromvbox_") > 0 Then | |
534 | WScript.Echo "Win32_PnPEntity ==> PnPEntity.DeviceID ==> " & PnPEntity.DeviceID | |
535 | VBoxFound = True | |
536 | End If | |
537 | End If | |
538 | If Not IsNull(PnPEntity.PNPDeviceID) Then | |
539 | PNPDeviceIDPnPEntity = LCase(PnPEntity.PNPDeviceID) | |
540 | If InStr(1,PNPDeviceIDPnPEntity,"diskvbox_") > 0 Or InStr(1,PNPDeviceIDPnPEntity,"cdromvbox_") > 0 Then | |
541 | WScript.Echo "Win32_PnPEntity ==> PnPEntity.PNPDeviceID ==> " & PnPEntity.PNPDeviceID | |
542 | VBoxFound = True | |
543 | End If | |
544 | End If | |
545 | End If | |
546 | Next | |
547 | ||
548 | 'Win32_NetworkConnection aka NetUse | |
549 | Set NetUseQ = objX.ExecQuery("SELECT * FROM Win32_NetworkConnection") | |
550 | For Each NetUse in NetUseQ | |
551 | If Not IsNull(NetUse) Then | |
552 | If Not IsNull(NetUse.Name) Then | |
553 | NameNetUse = LCase(NetUse.Name) | |
554 | If InStr(1,NameNetUse,"vboxsvr") > 0 Then | |
555 | WScript.Echo "Win32_NetworkConnection ==> NetUse.Name ==> " & NetUse.Name | |
556 | VBoxFound = True | |
557 | End If | |
558 | End If | |
559 | If Not IsNull(NetUse.Description) Then | |
560 | DescNetUse = LCase(NetUse.Description) | |
561 | If InStr(1,DescNetUse,"virtualbox shared folders") > 0 Then | |
562 | WScript.Echo "Win32_NetworkConnection ==> NetUse.Description ==> " & NetUse.Description | |
563 | VBoxFound = True | |
564 | End If | |
565 | End If | |
566 | If Not IsNull(NetUse.ProviderName) Then | |
567 | PrvNameNetUse = LCase(NetUse.ProviderName) | |
568 | If PrvNameNetUse = "virtualbox shared folders" Then | |
569 | WScript.Echo "Win32_NetworkConnection ==> NetUse.ProviderName ==> " & NetUse.ProviderName | |
570 | VBoxFound = True | |
571 | End If | |
572 | End If | |
573 | ||
574 | If Not IsNull(NetUse.RemoteName) Then | |
575 | RemoteNameNetUse = LCase(NetUse.RemoteName) | |
576 | If InStr(1,RemoteNameNetUse,"vboxsvr") > 0 Then | |
577 | WScript.Echo "Win32_NetworkConnection ==> NetUse.RemoteName ==> " & NetUse.RemoteName | |
578 | VBoxFound = True | |
579 | End If | |
580 | End If | |
581 | If Not IsNull(NetUse.RemotePath) Then | |
582 | RemotePathNetUse = LCase(NetUse.RemotePath) | |
583 | If InStr(1,RemotePathNetUse,"vboxsvr") > 0 Then | |
584 | WScript.Echo "Win32_NetworkConnection ==> NetUse.RemotePath ==> " & NetUse.RemotePath | |
585 | VBoxFound = True | |
586 | End If | |
587 | End If | |
588 | End If | |
589 | Next | |
590 | ||
591 | If VBoxFound = False Then | |
592 | WScript.Echo "VirtualBox Was Not Found" | |
593 | End If |