Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 252940

Re: Create VM using PowerCLI and csv file

$
0
0

Hi,

need help to install the 100 linux vm's with the powerCLI,

I read the previce scripts and used the same, i able to create the vm's but all the vm's are comming with the same host name( but the vm display name is redding from the excel as in csv file ) and the ip also now getting assined.

 

.ps1 file :

---------------------------------------------------------------------------------------------------------------------------------------------

Import-Csv "C:\guests.csv" -UseCulture | %{
    Get-OSCustomizationSpec $_.Customization | Get-OSCustomizationNicMapping | `
    Set-OSCustomizationNicMapping -IpMode UseStaticIP -IpAddress $_."IP Address" `
        -SubnetMask $_.Subnet -DefaultGateway $_.Gateway -Dns $_.DNS
    $vm=New-VM -Name $_."Server Name" -Template $_.Template -Host $_."Esx Host" `
        -Datastore $_.Datastore -Confirm:$false -RunAsync |
        Set-OSCustomizationSpec -OSCustomizationSpec $_.Customization

--------------------------------------------------------------------------------------------------------------------------------------------

.csv hedding :

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Server   NameEsx HostDatastoreTemplateCustomizationIP AddressSubnetGatewayDNS

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

 

Error message :

------------------------------------------------------------------------------------------------------------------------------------------

Set-OSCustomizationNicMapping : 3/7/2013 4:19:11 PM    Set-OSCustomizationNicMa
pping        You must not provide Wins or Dns when you create NIC mapping for a
customization spec with type 'linux'.
At C:\vmps2.ps1:3 char:34
+     Set-OSCustomizationNicMapping <<<<  -IpMode UseStaticIP -IpAddress $_."IP
Address" `
    + CategoryInfo          : InvalidArgument: (:) [Set-OSCustomizationNicMapp
   ing], ViError
    + FullyQualifiedErrorId : Core_NicMappingCmdletBase_ValidateParameters_Lin
   uxAndWins,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetOSCustomizationN
  icMapping

 

Set-OSCustomizationSpec : The input object cannot be bound to any parameters fo
r the command either because the command does not take pipeline input or the in
put and its properties do not match any of the parameters that take pipeline in
put.
At C:\vmps2.ps1:7 char:32
+         Set-OSCustomizationSpec <<<<  -OSCustomizationSpec $_.Customization
    + CategoryInfo          : InvalidArgument: (CloneVM_Task:PSObject) [Set-OS
   CustomizationSpec], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,VMware.VimAutomation.ViCore.
   Cmdlets.Commands.SetCustomizationSpec

 

Set-OSCustomizationNicMapping : 3/7/2013 4:19:16 PM    Set-OSCustomizationNicMa
pping        You must not provide Wins or Dns when you create NIC mapping for a
customization spec with type 'linux'.
At C:\vmps2.ps1:3 char:34
+     Set-OSCustomizationNicMapping <<<<  -IpMode UseStaticIP -IpAddress $_."IP
Address" `
    + CategoryInfo          : InvalidArgument: (:) [Set-OSCustomizationNicMapp
   ing], ViError
    + FullyQualifiedErrorId : Core_NicMappingCmdletBase_ValidateParameters_Lin
   uxAndWins,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetOSCustomizationN
  icMapping

 

Set-OSCustomizationSpec : The input object cannot be bound to any parameters fo
r the command either because the command does not take pipeline input or the in
put and its properties do not match any of the parameters that take pipeline in
put.
At C:\vmps2.ps1:7 char:32
+         Set-OSCustomizationSpec <<<<  -OSCustomizationSpec $_.Customization
    + CategoryInfo          : InvalidArgument: (CloneVM_Task:PSObject) [Set-OS
   CustomizationSpec], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,VMware.VimAutomation.ViCore.
   Cmdlets.Commands.SetCustomizationSpec

 

Set-OSCustomizationNicMapping : 3/7/2013 4:19:22 PM    Set-OSCustomizationNicMa
pping        You must not provide Wins or Dns when you create NIC mapping for a
customization spec with type 'linux'.
At C:\vmps2.ps1:3 char:34
+     Set-OSCustomizationNicMapping <<<<  -IpMode UseStaticIP -IpAddress $_."IP
Address" `
    + CategoryInfo          : InvalidArgument: (:) [Set-OSCustomizationNicMapp
   ing], ViError
    + FullyQualifiedErrorId : Core_NicMappingCmdletBase_ValidateParameters_Lin
   uxAndWins,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetOSCustomizationN
  icMapping

 

Set-OSCustomizationSpec : The input object cannot be bound to any parameters fo
r the command either because the command does not take pipeline input or the in
put and its properties do not match any of the parameters that take pipeline in
put.
At C:\vmps2.ps1:7 char:32
+         Set-OSCustomizationSpec <<<<  -OSCustomizationSpec $_.Customization
    + CategoryInfo          : InvalidArgument: (CloneVM_Task:PSObject) [Set-OS
   CustomizationSpec], ParameterBindingException
    + FullyQualifiedErrorId : InputObjectNotBound,VMware.VimAutomation.ViCore.
   Cmdlets.Commands.SetCustomizationSpec

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

Regrds,

Mohan.


Viewing all articles
Browse latest Browse all 252940

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>