VirtualBox

source: vbox/trunk/src/VBox/Frontends/VBoxShell/vboxinfo.vbs

Last change on this file was 98103, checked in by vboxsync, 16 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1' $Id: vboxinfo.vbs 98103 2023-01-17 14:15:46Z vboxsync $
2'' @file
3' ???
4'
5
6'
7' Copyright (C) 2009-2023 Oracle and/or its affiliates.
8'
9' This file is part of VirtualBox base platform packages, as
10' available from https://www.virtualbox.org.
11'
12' This program is free software; you can redistribute it and/or
13' modify it under the terms of the GNU General Public License
14' as published by the Free Software Foundation, in version 3 of the
15' License.
16'
17' This program is distributed in the hope that it will be useful, but
18' WITHOUT ANY WARRANTY; without even the implied warranty of
19' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20' General Public License for more details.
21'
22' You should have received a copy of the GNU General Public License
23' along with this program; if not, see <https://www.gnu.org/licenses>.
24'
25' SPDX-License-Identifier: GPL-3.0-only
26'
27
28Sub Print(str)
29 Wscript.Echo str
30End Sub
31
32Sub StartVm(vb, mach)
33 Dim session, progress
34
35 Set session = CreateObject("VirtualBox.Session")
36 Set progress = vb.openRemoteSession(session, mach.id, "gui", "")
37 progress.waitForCompletion(-1)
38 session.close()
39End Sub
40
41
42Sub StopVm(vb, mach)
43 Dim session, progress
44
45 Set session = CreateObject("VirtualBox.Session")
46 vb.openExistingSession session, mach.id
47 session.console.powerDown().waitForCompletion(-1)
48 session.close()
49End Sub
50
51
52Sub Main
53 Dim vb, mach
54
55 set vb = CreateObject("VirtualBox.VirtualBox")
56 Print "VirtualBox version " & vb.version
57
58 ' Safe arrays not fully functional from Visual Basic Script, as we
59 ' return real safe arrays, not ones wrapped to VARIANT and VBS engine
60 ' gets confused. Until then, explicitly find VM by name.
61 ' May wish to use hack like one described in
62 ' http://www.tech-archive.net/Archive/Excel/microsoft.public.excel.programming/2006-05/msg02796.html to handle safearrays
63 ' if desperate
64
65 Set mach = vb.findMachine("Win")
66 Print "Machine: " & mach.name & " ID: " & mach.id
67
68 StartVm vb, mach
69End Sub
70
71Main
72
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use