Leave a Reply

3 comments

  1. And in case you want to unregister them again:

    ‘Unregisters VMs that have the same name as the files in the current directory.
    ‘No questions asked!

    Dim objFSO, objVS
    Set objFSO = CreateObject(“Scripting.FileSystemObject”)
    Set objVS = CreateObject(“VirtualServer.Application”)

    ‘Obtain an folder object instance for a particular directory
    Dim objFolder
    Set objFolder = objFSO.GetFolder(“.”)

    Dim objFile
    For Each objFile in objFolder.Files
    On Error resume next
    If Right(objFile.Name,4) = “.vmc” then
    strVMName = Left(objFile.Name, Len(objFile.Name)-4)
    Set objVM = objVS.FindVirtualMachine(strVMName)
    objVS.UnregisterVirtualMachine(objVM)

    If Err.Number <> 0 Then
    WScript.Echo “UnRegistration of ‘” & strVMName & ” NOT successful: ” & Err.Description
    Else
    WScript.Echo “UnRegistration of ‘” & strVMName & ” successful”
    End If
    End if
    Next

    robp Reply

  2. Very handy script.

    Thank you!

    Fareed Reply

  3. Fantastic script! Both of them! Saved ma a ton of time on course 5115A and 5116A! Thanks!!!

    Marin Reply