book
                        
Article ID: CTX572712
                        
                    
                    
                        calendar_today
                        
Updated On: 
                    
                 
                
                    
                
                    
                    
                        
                            
Description
                        
                        
                            Unable to delete orphaned VMs by using Powershell from catalog which has already been removed via Powershell.
When running command: Remove-ProvScheme
The below error is seen:
"Leaving the non-persistent virtual machines of the provisioning scheme 'provisioning scheme name' at the hypervisor is not allowed.
                         
                     
                    
                    
                    
                    
                        
                            
                                
Resolution
                            
                            
                                To remove the Prov-scheme,
- Remove the left over VMs that are still associated with the Prov-scheme. 
	
- To check what VM's are left, you will need to run command: Get-ProvVM -ProvisioningSchemeName 'provisioning scheme name' | Select-Object vmname
 
	 - Once you have the name of the VMs, run the commands below: 
	
- Get-ProvVM -VMName "Name of VM"
		
- Note: from the output, you will need to take note of the ProvisioningSchemeUID field and copy the UID. 
 
		 -  Unlock-ProvVM -ProvisioningSchemeUID "UID taken from running output of running the previous command"
 -  Get-ProvVM -ProvisioningSchemeUID ""UID taken from running output of running the previous command" | Remove-ProvVM -VMName "Name of VM"
 
	 - Once you do this for each of the VMs, you will then be able to remove the prov-scheme by running command: 
	
- Remove-ProvScheme -ProvisioningSchemeName 'provisioning scheme name'
 
	 
Problem Cause
Issue is caused due to the Vms belonging to the prov-scheme are locked. 
                            
 
                         
                        
                    
                        
                            
                                
Issue/Introduction
                            
                            
                                Unable to delete orphaned VMs by using Powershell from catalog which has already been removed via Powershell.
When running command: Remove-ProvScheme
The below error is seen:
"Leaving the non-persistent virtual machines of the provisioning scheme 'provisioning scheme name' at the hypervisor is not allowed.