Try something like this?
I had a hard time with this piece for setting up my provisioning script.. it took some time but I finally got it. I have been using it for a while now.
Mine also is for provisioning linux vm's.
hope it helps
David
Get-OSCustomizationSpec -Name temp | Remove-OSCustomizationSpec -Confirm:$false
Get-OSCustomizationSpec -Name custemple | New-OSCustomizationSpec -Name temp -Type NonPersistent
Get-OSCustomizationSpec -Name temp | Set-OSCustomizationSpec -Name temp -DnsServer $dns -DnsSuffix $dnsSuffix -Domain $domainname
Get-OSCustomizationSpec -Name temp | Get-OSCustomizationNicMapping |Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $ip -SubnetMask $subnet -DefaultGateway $gw