![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Removing Hyper-V VMs From a Cluster Hello All, I want to say up front that this is a programming question and I'm not sure if this is the correct newsgroup to post this question in, but I can't seem to find one that fits my question. I figured I would try here first - if there's a more appropriate group, please let me know. Our organization has written a VBScript that automates VM deployment. It exports an existing VM image, re-imports and renames it, syspreps it and then adds the new VM to a Server 2008 Datacenter Edition 64-bit failover cluster. This script works fine. There is a second script (VBScript again) that is _supposed_ to do the reverse - it removes the VM from the cluster and then cleans up any left over VM directories and files. Unfortunately trying to delete the cluster resource returns a "generic failure (-2147217407)". The odd thing is that it does actually remove the VM from Hyper-V, it just doesn't remove the cluster resource. A snippet of the "destroy VM" script around where it fails is below: Set wmiVirt = GetObject("winmgmts:\\.\root\MSCluster") Set clustVmConfig = wmiVirt.ExecQuery("SELECT * FROM MSCluster_Resource WHERE Name LIKE '%" & vmName & "%' AND Type = 'Virtual Machine Configuration'").ItemIndex(0) Set clustVm = wmiVirt.ExecQuery("SELECT * FROM MSCluster_Resource WHERE Name LIKE '%" & vmName & "' AND Type = 'Virtual Machine'").ItemIndex(0) ' validation of VM UUID to cluster resource and offlining of VM happens here clustVmConfig.TakeOffline clustVmConfig.DeleteResource ' this call removes the VM from Hyper-V and returns the "generic failure" error clustVm.DeleteResource ' this call fails as well with the same error message What we're trying to accomplish via our script is obviously possible - the Failover Cluster Manager interface does it without issue. Any ideas as to why invoking the process would fail when called from VBScript? I'm completely open to the possibility that I've pooched the call somehow, but if that's the case, could you provide an example of the correct way to perform the operation (or a reference to an example on-line)? Thanks, dln |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Backing up Hyper-V cluster with Data Protection Manager 2007 | Virtual Server | |||
| Hyper-V Cluster Problems/Bug Reporting | Virtual Server | |||
| Hyper-V standalone vs Hyper-V windows 2008 Core | Virtual Server | |||
| Cannot manage an Hyper-V on Core from a full installed W2K8 with Hyper-V... | Virtual Server | |||
| Built a Windows 2008 Fail over Cluster running Hyper-V: articlesavailable if you are interested | Virtual Server | |||