Steinlaus
Contributor
Contributor

Trying to Set-OSCustomizationNicMapping IPAddress

Hi,

im trying to set the IP Address of a Machine that should be created from a template.

So far everything works - except setting the IP Address.

The System is Windows 2008 R2 so it runs without Sysprep etc...

So that is the part of the script that tries to set the IP Address in the Template:

$OSCustomizationNicMapping = Get-OSCustomizationNicMapping $spec

Set-OSCustomizationNicMapping -OSCustomizationNicMapping $OSCustomizationNicMapping -Position 1 -IpAddress 10.1.64.20

Set-OSCustomizationNicMapping -OSCustomizationNicMapping $OSCustomizationNicMapping -Position 2 -IpAddress 10.1.0.20

The first command of the Set-OSCustomizationNicMapping runs - but does not change anything. The second throws this error:

Set-OSCustomizationNicMapping : 1/20/2010 1:45:59 PM Set-OSCustomizationNicMapping The property Posiotion of the object has been changed. This property represents a part of the Id of the object so this operation is a

mbiguous. Please get object again and run the operation.

At S:\ManagementScripts\Provision-NewVM.ps1:24 char:30

+ Set-OSCustomizationNicMapping <<<< -OSCustomizationNicMapping $OSCustomizationNicMapping -Position 2 -IpAddress 10.1.0.20

+ CategoryInfo : ResourceUnavailable: (Smiley Happy , VimException

+ FullyQualifiedErrorId : Client20_ObjectVersionService_VerifyIsCurrentVersion_ExpiredObject,VMware.VimAutomation.VimAutomation.Commands.SetOSCustomizationNicMapping

Set-OSCustomizationNicMapping : 1/20/2010 1:45:59 PM Set-OSCustomizationNicMapping The property Posiotion of the object has been changed. This property represents a part of the Id of the object so this operation is a

mbiguous. Please get object again and run the operation.

At S:\ManagementScripts\Provision-NewVM.ps1:24 char:30

+ Set-OSCustomizationNicMapping <<<< -OSCustomizationNicMapping $OSCustomizationNicMapping -Position 2 -IpAddress 10.1.0.20

+ CategoryInfo : ResourceUnavailable: (Smiley Happy , VimException

+ FullyQualifiedErrorId : Client20_ObjectVersionService_VerifyIsCurrentVersion_ExpiredObject,VMware.VimAutomation.VimAutomation.Commands.SetOSCustomizationNicMapping

Im a bit confused what the error does tell me Smiley Happy

Thanks

/Steinlaus

0 Kudos
1 Reply
Steinlaus
Contributor
Contributor

Addendum:

Using Remove-OSCustomization in combination of NewOSCustomizationNicMapping solves part of the Problem.

The next Problem is that i only want to specify an IP Address for one interface but no gateway and no dns servers.

Is that possible?

0 Kudos