Hey there!
I ran into the same problem with tons of error messages when deploying a Windows Server 2012 R2 based Template-VM with OSCustomizationSpec.
The thing is that it works flawlessly for Windows Server 2016.
I have two customization specification definitions, one for 2012 and one for 2016.
I compared those two definitions in two separate windows next to each other and they match 1:1 perfectly.
I did not use the -NamingScheme or -NamingPrefix before with Windows Server 2016.
Adding those to be able to occasionally deploy also Windows Server 2012 R2 VMs from a template added new errors that I do not understand.
$lineCount = 1
$tmpOSCust = "_tmp-OSC_" + $lineCount
$Spec = Get-OSCustomizationSpec $_.OSCustom | New-OSCustomizationSpec -Name $tmpOSCust -Type NonPersistent -NamingScheme fixed -NamingPrefix "tmp"
Hint: The variable $_.OSCustom is a value read from a .csv file and determines the customization specification name used.
The error message I get is this:
New-OSCustomizationSpec : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and
its properties do not match any of the parameters that take pipeline input.
At line:1 char:82
+ ... i-net.com | New-OSCustomizationSpec -Name $tmpOSCust -Type NonPersist ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (Win2k12R2_IP-Ad...ame_gwi-net.com:PSObject) [New-OSCustomizationSpec], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewCustomizationSpec
The above statement obviously fails, no new customization specification is being created.
Why does the template used or the server OS installed make a difference?
I think I can live with the fact that my script works fine the way it is with 2016, but as sometimes a bunch of WS2K12 VMs need to be deployed would help me save a lot of time, now that I have that all scripted.
Tanks!
BR
NC