Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for vmlist.vbs

(view source code of vmlist.vbs as plain text)

  1. On Error Resume Next
  2.  
  3. Set virtualServer = CreateObject( "VirtualServer.Application" )
  4. If Err Then Syntax( )
  5.  
  6. strMsg = ""
  7.  
  8. For Each objVM In virtualServer.VirtualMachines
  9. 	strMsg = strMsg & "VM file name     : "         & objVM.File               & vbCrLf
  10. 	For Each objVhd In objVM.HardDiskConnections
  11. 		strMsg = strMsg & "Virtual harddisk : " & objVHD.HardDisk.File     & vbCrLf
  12. 		strMsg = strMsg & "Undo harddisk    : " & objVHD.undoHardDisk.File & vbCrLf
  13. 	Next
  14. 	strMsg = strMsg & "VM status        : "         & objVM.State     & vbCrLf & vbCrLf & vbCrLf
  15. Next
  16.  
  17. WScript.Echo strMsg
  18.  
  19.  
  20. Sub Syntax( )
  21. 	strMsg = vbCrLf & "VMList.vbs,  Version 1.00" & vbCrLf _
  22. 	       & "List all Virtual Machines and their associated" & vbCrLf _
  23. 	       & "files on the local Virtual Server Host" & vbCrLf & vbCrLf _
  24. 	       & "Usage:  CSCRIPT  VMLIST.VBS" & vbCrLf & vbCrLf _
  25. 	       & "Written by Rob van der Woude" & vbCrLf _
  26. 	       & "http://www.robvanderwoude.com" & vbCrLf
  27. 	WScript.Echo strMsg
  28. 	WScript.Quit 1
  29. End Sub
  30.  

page last modified: 2024-04-16; loaded in 0.0103 seconds