VirtualBox

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

Last change on this file since 29806 was 28800, checked in by vboxsync, 15 years ago

Automated rebranding to Oracle copyright/license strings via filemuncher

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