VMware Cloud Community
rizwann7
Contributor
Contributor
Jump to solution

How do i add OS customization like OS Name and IP configuration inside the VM

Dear experts,

I've powercli script in which VM create from the template but my concern is  "I need to add count query and change os name inside the VM and IP address from the CSV file" after that once the VM create then I receive an email that VM has been created. Could someone help me with it, please?

this my working script :

$templateName = 'ASD-DEP-VM14-Server-2008-BaseImage'

$esxName = '10.5.10.231'

$clusterName = 'ASD CLU #02 - VDI'

$dsName = 'ASD DS #002 - FC'

$template = Get-Template -Name $templateName

$ds = Get-Datastore -Name $dsName

$cluster = Get-Cluster -Name $clusterName

$esx = Get-VMHost -Name $esxName

$vm = New-VM -Template $template -Name Rizwannewvm -ResourcePool $cluster -Datastore $ds -DiskStorageFormat Thin |

Set-VM -NumCpu 2 -MemoryGB 4 -Confirm:$false

Get-HardDisk -VM $vm | Set-HardDisk -CapacityGB 100

Start-VM -VM $vm -Confirm:$false

Tags (1)
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Have a look at this other blog post, see VM Deployment With PowerCLI part one

It does exactly what you are trying to do.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
3 Replies
LucD
Leadership
Leadership
Jump to solution

It depends a bit on which guest OS you have inside the VM.

For Windows guest OS you have many configuration options, including hostname and IP address, with the OSCustomizationSpec.

There are many examples available, in this community, but also by many bloggers.

See for example How to automate VMWare VM creation using powercli oscustomizationspec


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
rizwann7
Contributor
Contributor
Jump to solution

I've several types of templates in my Vsphere but now we talk about windows server like the previous script deployed the VM but I want to change windows os name and ip address from csv file. how can I do that please suggestion also I visited the link as well but not understanding much could you help me with it, please?

Reply
0 Kudos
LucD
Leadership
Leadership
Jump to solution

Have a look at this other blog post, see VM Deployment With PowerCLI part one

It does exactly what you are trying to do.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos