VMware Cloud Community
vinivirtus
Enthusiast
Enthusiast

Create VM via script powercli

Friends,

I have a script to mass deploy vm however I am struggling to change the script to create the virtual server with more than one network card, I wonder if algume could analyze my script and help me I'm working on some days I am already able seeking a way to configure this option however I am not having success.:smileycry:

Reply
0 Kudos
2 Replies
sajal1
VMware Employee
VMware Employee

Hello vinivirtus,

Do you need to add a NIC card with all the details or just a NIC? Anyways you can simple add more fields in the deployVMserverinfo.csv file with the network details. You can simply add another field which says for example "extraNic" and value should be '0' or '1', '0' is for no extra NIC and 1 is for extra NIC. So if this field is '1' then you can check further fields otherwise there is no need to check extra fields. No once you initialize the parameters with the extra NIC information you can simple add the extra nic with the following:

New-NetworkAdapter -VM $vmname -NetworkName "VM Network" -MacAddress 'aa:bb:cc:dd:ee:ff' -WakeOnLan -StartConnected

This should be within the function Exec() at the end

Hope this gives the enough information what you are looking for.

Reply
0 Kudos
vinivirtus
Enthusiast
Enthusiast

friend

I am wanting to add a new network adapter with settings already put the IP, MASK and GATEWAY is to create VM Guest Linux RED HAT 6.

There is a parameter in PowerCLI that made ​​possible to add this information which is requested by the root login to login the VM and configure this information.

More thanks for the help, I will do some tests.

Thank you.

Reply
0 Kudos