Description of problem: Provisioning to Microsoft System Center Virtual Machine Manager runs a New-SCCVirtualMachine command and passes an argument of -VMHost with the value of the VMDB host object .name (host.name). You can see in the debug log below from scvmm.log that the VMHost is being passed with a " - 4" appended as the host was removed and readded to SCVMM several times and each time gets a new ems_ref. Jun 14 13:56:23 cfme01 cf_scvmm: $vm = New-SCVirtualMachine -Name 'testvm1' -VMHost hyperv_hostname.example.com - 4 -Path '\\nas.example.com\ShareName' -VMTemplate (Get-SCVMTemplate -Name '2016'); Set-SCVirtualMachine -VM $vm -CPUCount 1 -DynamicMemoryEnabled $false -MemoryMB 4096 | Out-Null; $adapter = $vm | SCVirtualNetworkAdapter; Set-SCVirtualNetworkAdapter -VirtualNetworkAdapter $adapter -LogicalNetwork (Get-SCLogicalNetwork -Name 'LP 2069 MC vRA Win Dev') | Out-Null; $vm | Select-Object ID | ConvertTo-Json This yields the following error: Jun 14 13:56:23 cfme01 cf_scvmm: [----] D, [2017-06-14T13:56:18.205456 #4091:605130] DEBUG -- : Q-task_id([miq_provision_10000000001416]) MIQ(ManageIQ::Providers::Microsoft::InfraManager#run_powershell_script) Execute Powershell Script... Jun 14 13:56:23 cfme01 cf_scvmm: [----] E, [2017-06-14T13:56:21.781163 #4091:605130] ERROR -- : Q-task_id([miq_provision_10000000001416]) MIQ(Class#log_dos_error_results) New-SCVirtualMachine : A positional parameter cannot be found that accepts argument '-'. Version-Release number of selected component (if applicable): 5.7.2 How reproducible: Every time you provision to a host where the host.name doesn't match the host.hostname. Steps to Reproduce: 1. In CloudForms UI, edit a host resource and rename it to have a - 1 in it and then provision to it. Additional info: irb(main):003:0> $evm.vmdb(:host).where("name ~ 'hyperv-hostname'").each { |i| puts i.name } hyperv-hostname.example.com hyperv-hostname.example.com - 2 hyperv-hostname.example.com - 3 hyperv-hostname.example.com - 4 irb(main):005:0> $evm.vmdb(:host).where("name ~ 'hyperv-hostname'").each { |i| puts i.ems_ref } d8e310fc-d63f-4603-aba8-33a4ccbbd31d 65c286ce-9f96-4c55-8361-55f7ed36a3d4 62e68605-be94-4a27-a8ee-d0b369431887 8f179946-df85-436a-8a7f-59ab47dbb05c irb(main):006:0> $evm.vmdb(:host).where("name ~ 'hyperv-hostname'").each { |i| puts i.hostname } hyperv-hostname.example.com hyperv-hostname.example.com hyperv-hostname.example.com hyperv-hostname.example.com
I can test for that. I'll take a look.
https://github.com/ManageIQ/manageiq/pull/15632