VMware Cloud Community
Thushyaaa
Contributor
Contributor

OSCustomization

Hello, I am using the below script to deploy number of vms and do a customization to complete the deployment..

$vms = Import-CSV D:\VMs.csv

foreach ($vm in $vms){

$Template = Get-Template $vm.template

$VMHost = Get-VMHost $vm.host

$Datastore = Get-Datastore $vm.datastore

$OSCustomization = Get-OSCustomizationSpec $vm.customization

New-VM -Name $vm.name -OSCustomizationSpec $vm.OSCustomization -Template $Template -VMHost $VMHost -Datastore $Datastore -RunAsync

}

VMs.csv is...

Name,Template,Host,Datastore,Customization

VM0001,VMTEMPC,192.168.2.3,"datastore1",Deploy-XPSP3

If runs and i am able to deply any number of vms but the issue is the customization part does not work, i tested running it manually that works, why the script not doing the customization ?

thank you.

Reply
0 Kudos
3 Replies
Dave_Mishchenko
Immortal
Immortal

Do you see a customization task created and do you power on the VMs after they're created to allow sysprep to run. You might also want to enclose the customization name in quotes as it includes a hyphen.




Dave

VMware Communities User Moderator

Now available - vSphere Quick Start Guide

Do you have a system or PCI card working with VMDirectPath? Submit your specs to the Unofficial VMDirectPath HCL.

Reply
0 Kudos
Thushyaaa
Contributor
Contributor

I tried as you have pointed, but no luck. again i tried manual, it worked, do not know what was the issue.

Reply
0 Kudos
nnedev
VMware Employee
VMware Employee

Hi,

I have the following questions:

1. Is customization succeeding when executing the scripts line by line ?

2. Are you getting errors ? If yes please post them here.

3. Do you have the correct versions of sysprep. Note that you need to have different sysprep for each windows version. Here is an article about sysprep deployment in vCenter - http://vmetc.com/2009/08/18/how-to-add-sysprep-to-vmware-vcenter-for-vm-customizations-vmware-conver...

Looking forward for your next post.

Regards,

Nedko Nedev

PowerCLI Development Team

Regards, Nedko Nedev PowerCLI Development Team
Reply
0 Kudos