home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2007 April / PCpro_2007_04.ISO / files / usb / VMware-server-installer101.exe / sample3.vbs < prev    next >
Encoding:
Text File  |  2006-08-09  |  5.1 KB  |  102 lines

  1. '  VmCOM VBScript Sample Program 3
  2. '  Copyright 1998 VMware, Inc.  All rights reserved. -- VMware Confidential
  3. '  
  4. '  Permission is hereby granted, free of charge, to any person obtaining a
  5. '  copy of the software in this file (the "Software"), to deal in the
  6. '  Software without restriction, including without limitation the rights to
  7. '  use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. '  copies of the Software, and to permit persons to whom the Software is
  9. '  furnished to do so, subject to the following conditions:
  10. '  
  11. '  The above copyright notice and this permission notice shall be included in
  12. '  all copies or substantial portions of the Software.
  13. '  
  14. '  The names "VMware" and "VMware, Inc." must not be used to endorse or
  15. '  promote products derived from the Software without the prior written
  16. '  permission of VMware, Inc.
  17. '  
  18. '  Products derived from the Software may not be called "VMware", nor may
  19. '  "VMware" appear in their name, without the prior written permission of
  20. '  VMware, Inc.
  21. '  
  22. '  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  23. '  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  24. '  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  25. '  VMWARE,INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  26. '  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27. '  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  28. '
  29. '  ------
  30. '
  31. '  This program is for educational purposes only.
  32. '  It is not to be used in production environments.
  33. '
  34. '  Description:
  35. '
  36. '  This script gets a list of virtual machines registered on
  37. '  the local server.  It attempts to power-on each VM that
  38. '  is not already running and has a line in the config file:
  39. '
  40. '  autostart=true
  41. '
  42. '
  43. '  Instructions for Windows 2000 and Windows XP host:
  44. '
  45. '  - save the contents of this file to a file named 'sample3.vbs'
  46. '
  47. '  - there should be an accompanying file named 'sample3.wsf'
  48. '    It is placed in the same directory as this file during
  49. '    product installation. This file is responsible for setting
  50. '    up the Windows Script Host environment and loading the
  51. '    VmCOM type library, thereby enabling this script to 
  52. '    reference symbolic constants such as vmExecutionState_On
  53. '
  54. '  - in a command line window, type:
  55. '    cscript //nologo sample3.wsf
  56.  
  57. Set connect_params = CreateObject("VmCOM.VmConnectParams")
  58.  
  59. ' By default, connects to the local server.
  60. ' To connect to a remote server, uncomment these lines and set
  61. ' the values appropriately.
  62. '
  63. ' connect_params.hostname = "<host>"
  64. ' connect_params.username = "<user>"
  65. ' connect_params.password = "<password>"
  66. '
  67. ' And use this if your port number is different
  68. ' connect_params.port = 902
  69.  
  70. Set vm_server = CreateObject("VmCOM.VmServerCtl")
  71.  
  72. ' Handle errors non-fatally from here on
  73. On Error Resume Next
  74.  
  75. '
  76. ' Try connecting to server a few times. It's possible the VMware services
  77. ' are still in the process of starting up. We'll wait a maximum of
  78. ' 12 * 10 = 120 seconds = 2 minutes
  79. '
  80. connected = false
  81. for tries = 1 to 12
  82.    vm_server.Connect connect_params
  83.    if Err.number = 0 then
  84.       = 2 minutes
  85. DN-ree w"l"+Pncluded in
  86. //  sample3.IxG
  87. //
  88. //  ------tC2863C385E30}#1.0#0"; "MSFLXGRD.OCX --Btion VB.Form MiniMUIForm t_parCa OR OTTTTTTTTT= ew RegExp Mini-MUI  thi s = s & " UNA -----CliuctHe     TTT= ew8280-----CliuctLeftTTTTTT= ew60-----CliuctTopTTTTTTT= ew345-----CliuctWidervTTTT= ew6960-----LinkTopionTTTTTT= ew MiniMUI -----ShiseHe     TTTT= ew8280-----ShiseWidervTTTTT= ew6960-----word>UpPosie", norew3 Ree, to anDe is
  89. -----Btion VB.C copy,Butt, ne confiLso, Cmdfrom hereCa OR OTTTTTTTTT= ew cript gets  so, subjectVmNames
  90. He     TTTTTTTTT= ew255mNames
  91. LeftTTTTTTTTTTTT= ew504the proceTabIramxTTTTTTTT= ew52he proceTopTTTTTTTTTTTTT= ew36the proceWidervTTTTTTTTTT= ew1815mNameEnd-----Btion VB.TnecBox VMwaInfo mNames
  92. He     TTTTTTTTT= ew285mNames
  93. LeftTTTTTTTTTTTT= ewRRAhe proceTabIramxTTTTTTTT= ew50he proceTopTTTTTTTTTTTTT= ew588the proceWidervTTTTTTTTTT= ew1815mNameEnd-----Btion VB.C copy,Butt, nbuildCmdfrom hereCa OR OTTTTTTTTT= ew BuildVmNames
  94. He     TTTTTTTTT= ew255mNames
  95. LeftTTTTTTTTTTTT= ew588the proceTabIramxTTTTTTTT= ew49he proceTopTTTTTTTTTTTTT= ew588the proceWidervTTTTTTTTTT= ew975mNameEnd-----Btion VB.C copy,Butt, nplatloamCmdfrom hereCa OR OTTTTTTTTT= ew PlatloamVmNames
  96. He     TTTTTTTTT= ew255mNames
  97. LeftTTTTTTTTTTTT= ew444the proceTabIramxTTTTTTTT= ew48he proceTopTTTTTTTTTTTTT= ew588the proceWidervTTTTTTTTTT= ew1335mNameEnd-----Btion VB.C copy,Butt, npMware Cmdfrom hereCa OR OTTTTTTTTT= ew PMware VmNames
  98. He     TTTTTTTTT= ew255mNames
  99. LeftTTTTTTTTTTTT= ew3n the proceTabIramxTTTTTTTT= ew47he proceTopTTTTTTTTTTTTT= ew588the proceWidervTTTTTTTTTT= ew1335mNameEnd-----Btion VB.C copy,Butt, nlt,crip connCmdfrom hereCa OR OTTTTTTTTT= ew G  copies oo the locVmNames
  100. He     TTTTTTTTT= ew255mNames
  101. LeftTTTTTTTTTTTT= ew49RAhe proceTabIramxTTTTTTTT= ew46he proceTopTTTTTTTTTTTTT= ew648the proceWidervTTTTTTTTTT= ew1935mNameEnd-----Btion VB.C copy,Butt, n filLegacySrvCmdfrom hereHe