Hello there!
I am looking to deploy service templates via a PowerShell script, i.e. using VMM PowerShell cmdlets. I am able to do this when the computer name (with no wildcards; just a string literal) is provided within the VM template. Here is how:
$HostGroup = Get-SCVMHostGroup | where { $_.Path -eq "All Hosts\..." } $ServiceTemplate = Get-SCServiceTemplate -Name "my-service-template" $ServiceConfig = New-SCServiceConfiguration -ServiceTemplate $ServiceTemplate -Name "TestServiceAuto" -VMHostGroup $HostGroup $NewService = New-SCService -ServiceConfiguration $ServiceConfig
However, when the computer name within the VM template is a *, the deployment fails, understandably, since the computer name isn't set in the code above (evidently, it isn't automatically assigned either).
When using the GUI, in the Deploy Service window (window that opens up when you click on Configure Deployment for a service template), it is possible enter the VM name. So, when I had a * within the VM template, that is what I did when using the GUI.
With the commands above, there doesn't seem to be a way to set the VM name. Is this true? Or is there a way to do it?
Thanks!
-Rohan.