Can't remove SCSI VHD from a guest using PSHyperV


ws2008 r2 sp1 core hv host, pshyperv r2 gold. posted pshyperv board few weeks ago, appears nobody's home. have pshyperv experts here.

trying script removing scsi vhd's guest. scsi disk has been "safely removed" vm before running ps commands.

i've tried 2 methods (to remove disks "backup" in names):

get-vmdisk | {$_.diskpath -match "backup"} | foreach {remove-vmdrive -diskonly -vm $_.vmelementname -controllerid $_.controllerid -l $_.drivelun}  

there no error posted, , get-vmdisk no longer lists disk. disk still present in vm, , visible in hyper-v console.

i've tried using menu. worked through selections until asked confirm removal of disk, @ point failed report:

  remove-vmrasd :   failed remove hard drive from 01infr001:   result '01infr001' failed remove device 'microsoft synthetic disk drive':   generic failure (0x80041001) (virtual machine id 4b24032c-f48b-420a-a409-662078a3c696)'01infr001':   storage drive resource allocation setting data object 'microsoft:4b24032c-f48b-420a-a409-662078a3c696\8a80a751-5d76-4877-9f39-687179621949\0\2\d'   cannot deleted because logical disk object still attached it.   (virtual machine id 4b24032c-f48b-420a-a409-662078a3c696).  @ c:\program files\modules\hyperv\menu.ps1:1283 char:46  + remove-vmrasd <<<< -vm $vm -rasd (get-wmiobject -computername $vm.__server -namespace $hypervnamespace -query $wql) -confirm  + categoryinfo     : notspecified: (:) [write-error], writeerrorexception  + fullyqualifiederrorid : microsoft.powershell.commands.writeerrorexception,remove-vmrasd  

hi

are using updated version (gold version) of pshyperv?
can check udocumentation for updated version here : http://pshyperv.codeplex.com/releases/view/38769#downloadid=101935

also there software (free) : r1soft hyper-v vhd explorer : http://www.r1soft.com/tools/hyper-v-vhd-explorer/. has command line utility scripting attach , detach of vhd files

 


if post helpful, please mark such
________________________________________
alessandro cardoso
mvp | microsoft heroes | mct
blog: http://virtualisationandmanagement.wordpress.com
http://virtualizacaoegerenciamento.wordpress.com


Windows Server  >  Hyper-V



Comments

Popular posts from this blog

some help on Event 540

WMI Repository 4GB limit - Win 2003 Ent Question

Event ID 1302 (error 1307) DFS replication service encountered an error while writing to the debug log file