VirtualBox

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

Last change on this file since 69935 was 69500, checked in by vboxsync, 7 years ago

*: scm --update-copyright-year

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 1.7 KB
Line 
1' $Id: vboxinfo.vbs 69500 2017-10-28 15:14:05Z vboxsync $
2'' @file
3' ???
4'
5
6'
7' Copyright (C) 2009-2017 Oracle Corporation
8'
9' This file is part of VirtualBox Open Source Edition (OSE), as
10' available from http://www.virtualbox.org. This file is free software;
11' you can redistribute it and/or modify it under the terms of the GNU
12' General Public License (GPL) as published by the Free Software
13' Foundation, in version 2 as it comes in the "COPYING" file of the
14' VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15' hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16'
17
18Sub Print(str)
19 Wscript.Echo str
20End Sub
21
22Sub StartVm(vb, mach)
23 Dim session, progress
24
25 Set session = CreateObject("VirtualBox.Session")
26 Set progress = vb.openRemoteSession(session, mach.id, "gui", "")
27 progress.waitForCompletion(-1)
28 session.close()
29End Sub
30
31
32Sub StopVm(vb, mach)
33 Dim session, progress
34
35 Set session = CreateObject("VirtualBox.Session")
36 vb.openExistingSession session, mach.id
37 session.console.powerDown().waitForCompletion(-1)
38 session.close()
39End Sub
40
41
42Sub Main
43 Dim vb, mach
44
45 set vb = CreateObject("VirtualBox.VirtualBox")
46 Print "VirtualBox version " & vb.version
47
48 ' Safe arrays not fully functional from Visual Basic Script, as we
49 ' return real safe arrays, not ones wrapped to VARIANT and VBS engine
50 ' gets confused. Until then, explicitly find VM by name.
51 ' May wish to use hack like one described in
52 ' http://www.tech-archive.net/Archive/Excel/microsoft.public.excel.programming/2006-05/msg02796.html to handle safearrays
53 ' if desperate
54
55 Set mach = vb.findMachine("Win")
56 Print "Machine: " & mach.name & " ID: " & mach.id
57
58 StartVm vb, mach
59End Sub
60
61Main
62
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette