While deploying a vm from specification, i am getting error. Herewith i have attached the script & error.
Script:
Connect-VIServer 172.16.0.126
#Get-Content "c:\ipset.csv" | %{
#Import-Csv "C:\ipset.csv" -UseCulture | %{
#$custSpec = New-OSCustomizationSpec -name ostest25 -Type NonPersistent -OSType Windows -OrgName “My Organization” -FullName “MyVM3” -Domain “test1.com” –DomainUsername “test1\administrator” –DomainPassword “Ganesh@123”
$custSpec = New-OSCustomizationSpec -Name Spec2 -OSType Windows -Description "This spec `
adds a computer in a domain." -FullName Administrator -OrgName Organization -NamingScheme Fixed -NamingPrefix "Computer" -LicenseMode Perserver -LicenseMaxConnections 30 -AdminPassword "Ganesh@123" -Domain test1.com -DomainUsername administrator -DomainPassword "Ganesh@123"
Write-output $custSpec
$os1 = Get-OSCustomizationSpec $custSpec
Write-output $os1
$os2 = $os1 | get-OSCustomizationNicMapping
Write-output "Get-OSCustomizationNicMapping" $os2
$os3 = $os2 | Set-OSCustomizationNicMapping -IpMode UseStaticIp -IpAddress "172.16.0.248" -SubnetMask "255.255.0.0" -DefaultGateway 172.16.0.101 -Dns 172.16.0.101
Write-output "Set-OSCustomizationNicMapping" $os3
New-VM -VMhost 172.16.0.240 -name test5675 -Template win2k3template1 -Datastore "iScsi Lun2" -OSCustomizationSpec $custSpec
Error:
New-VM : 8/8/2010 2:07:49 PM New-VM The operation for the entity Virt
ualMachine-vm-248 failed with the following message: "Customization failed."
At C:\serverset.ps1:21 char:7
+ New-VM <<<< -VMhost 172.16.0.240 -name test5675 -Template win2k3template1 -D
atastore "iScsi Lun2" -OSCustomizationSpec $custSpec
+ CategoryInfo : NotSpecified: ( , CustomizationFault
+ FullyQualifiedErrorId : Client20_TaskServiceImpl_CheckServerSideTaskUpda
tes_OperationFailed,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM
What OS did you install the vCenter on ?
For a W2K8 server, the logs can be found in C:\ProgramData\VMware\VMware VirtualCenter\Logs
For a W2K3 server, the logs are in C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\Logs
There must be some vpxd logs.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Can you temporarily switch the logging to 'verbose' and run the script again ?
Perhaps attach the log output instead of placing it inline in the message.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks, Changed to Verbose method.
Tried the script & failed again with following error.
Recording (25513f0:0) DELETE FROM VPX_ALARM_RUNTIME WHERE ENTITY_ID=?
GetPropertyProvider failed for vm-396
GetPropertyProvider failed for vm-396
Invoke done: vmodl.query.PropertyCollector.waitForUpdates session: D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
Recording (2551540:0) INSERT INTO VPX_EVENT (EVENT_ID, CHAIN_ID, EVENT_TYPE, CREATE_TIME, USERNAME, CATEGORY, VM_ID, VM_NAME, HOST_ID, HOST_NAME, COMPUTERESOURCE_ID, COMPUTERESOURCE_TYPE, COMPUTERESOURCE_NAME, DATACENTER_ID, DATACENTER_NAME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
Recording (2551540:1) INSERT INTO VPX_EVENT_ARG (EVENT_ID, ARG_ID, ARG_TYPE, ARG_DATA, OBJ_TYPE, OBJ_NAME) VALUES (?, ?, ?, ?, ?, ?)
Recording (2551540:2) INSERT INTO VPX_EVENT_ARG (EVENT_ID, ARG_ID, ARG_TYPE, ARG_DATA, OBJ_TYPE, OBJ_NAME) VALUES (?, ?, ?, ?, ?, ?)
Recording (2551540:3) INSERT INTO VPX_EVENT_ARG (EVENT_ID, ARG_ID, ARG_TYPE, ARG_DATA, OBJ_TYPE, OBJ_NAME) VALUES (?, ?, ?, ?, ?, ?)
Event[4353]: Failed to deploy template: Customization failed.
Throw vim.fault.CustomizationFault
-- FINISH task-490 -- vm-248 -- vim.VirtualMachine.clone -- 0543E3D3-A829-4671-9A34-13C45E634665
-- ERROR task-490 -- vm-248 -- vim.VirtualMachine.clone: vim.fault.CustomizationFault:
(vim.fault.CustomizationFault) {
dynamicType = ,
msg = ""
}
pool:1, 1 out of 1 connections are available
Invoke done: vmodl.query.PropertyCollector.waitForUpdates session: 0543E3D3-A829-4671-9A34-13C45E634665
-- BEGIN task-internal-222 -- -- vim.view.ViewManager.createListView -- D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
Invoke done: vim.view.ViewManager.createListView session: D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
-- FINISH task-internal-222 -- -- vim.view.ViewManager.createListView -- D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
-- BEGIN task-internal-223 -- -- vmodl.query.PropertyCollector.createFilter -- D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
Invoke done: vmodl.query.PropertyCollector.createFilter session: D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
-- FINISH task-internal-223 -- -- vmodl.query.PropertyCollector.createFilter -- D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
-- BEGIN task-internal-224 -- -- vmodl.query.PropertyCollector.retrieveContents -- D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
Invoke done: vmodl.query.PropertyCollector.retrieveContents session: D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
-- FINISH task-internal-224 -- -- vmodl.query.PropertyCollector.retrieveContents -- D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
Recording (2551540:0) UPDATE VPX_TASK SET NAME = ? , DESCRIPTIONID = ? , ENTITY_ID = ? , ENTITY_TYPE = ? , ENTITY_NAME = ? , LOCKED_DATA = ? , COMPLETE_STATE = ? , CANCELLED = ? , CANCELLABLE = ? , ERROR_DATA = ? , RESULT_DATA = ? , REASON_DATA = ? , QUEUE_TIME = ? , START_TIME = ? , COMPLETE_TIME = ? , EVENT_CHAIN_ID = ? WHERE TASK_ID = ?
Invoking on [vim.view.ListView:session[D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F]8F5DF130-DF7A-42E0-BBA9-A9EFEB2B8EA1] session
-- BEGIN task-internal-225 -- -- vim.view.ListView.modify -- D45F31FA-A9FB-4EA0-BCF6-657E0AF5179F
Can't see anything wrong.
A wild guess, can you try to change New-OSCustomizationSpec line as follows
$custSpec = New-OSCustomizationSpec -Name Spec2 -OSType Windows -Description "This spec adds a computer in a domain." ` -FullName Administrator -OrgName Organization -NamingScheme Fixed -NamingPrefix "Computer" ` -LicenseMode Perserver -LicenseMaxConnections 30 -AdminPassword "Ganesh@123" ` -Domain test1.com -DomainUsername administrator -DomainPassword "Ganesh@123"
I think the way you did it, that the description field will have a CR-LF in it.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks, tried with your option. It didn't worked out..
Is there any wrong in my steps...
You've answered to another person, for him it worked with same script.. where is the fault in mine?
Ok my requirement is to deploy a vm with single nic (or) 2 nic, with following script, correct me if there is any wrong... Thanks...
Is my Customization steps are correct? because i am not good in scripts...... pleease assist me...
Connect-VIServer 172.16.0.126
#Get-Content "c:\ipset.csv" | %{
#Import-Csv "C:\ipset.csv" -UseCulture | %{a
$custSpec = New-OSCustomizationSpec -Name Spec5 -OSType Windows -Description "This spec adds a computer in a domain." `
-FullName Administrator -OrgName Organization -NamingScheme Fixed -NamingPrefix "Computer" `
-LicenseMode Perserver -LicenseMaxConnections 30 -AdminPassword "Ganesh@123" `
-Domain test1.com -DomainUsername administrator -DomainPassword "Ganesh@123"
#Write-output $custSpec
$os1 = Get-OSCustomizationSpec $custSpec
Write-output $os1
$os2 = $os1 | get-OSCustomizationNicMapping
Write-output "Get-OSCustomizationNicMapping" $os2
$os3 = $os2 | Set-OSCustomizationNicMapping -IpMode UseStaticIp -IpAddress "172.16.0.248" -SubnetMask "255.255.0.0" -DefaultGateway 172.16.0.101 -Dns 172.16.0.101
Write-output "Set-OSCustomizationNicMapping" $os3
New-VM -VMhost 172.16.0.240 -name test5675 -Template win2k3template1 -Datastore "iScsi Lun2" -OSCustomizationSpec $custSpec
Hello,
Can you confirm that you are working with the latest PowerCLI version, build 264274?
The latest version has a commandlet named Get-ErrorReport which can be used in this situation. It will generate error report that you can provide for further investigation.
For example, you can call something like this:
get-errorreport -ProblemScript { put Your New-VM call here } -ProblemDescription 'New-VM + customization spec' -ProblemScriptTimeoutSeconds 1200 -Destination c:\errorOutput\
This line will produce a zip file in the pointed destination folder that you can upload. Make sure that the specified timeout will be enough for completion of the clone task.
There is a interesting blog post about Get-ErrorReport:
Vitali,
PowerCLI team
Well, I tried your statements again on my side and they seem to work without a problem for me.
Can you edit the Customization Spec from the vSphere client ?
Could also be the template you start from.
Can you try with a fresh template, perhaps cloned from a W2K3 guest that you have running.
What PowerCLI version are you running ?
Get-PowerCLIVersion
Oops, didn't see your reply Vitali.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Stupid question perhaps, but did you set up the sysprep files on your vCenter ?
See KB1005593 for the locations.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Are you asking me, whether did I ran sysprep on my VC server?
Answer should be yes, if i missed anything i will create a new Windows server for VC and try out this, give me a day.
Is it working for you? Will this work on ESX 3.5?
No, you shouldn't run a sysprep on your vCenter, but you should copy the sysprep files to the folder on your vCenter as described in the KB.
I did a test on vCenter 4.1 and ESX 4.1.
Sorry, don't have any 3.5 left to test.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
For me it fails in VC4 too, the same script...
Am i doing any mistake? it deploys VM then it says unable to customize.. I have changed to Verbose, and no VPXD logs found in VC during the time..
Hi again,
When applying customization specification the count of network adapters of the source template should be equal to the count of the nic mapping objects specified in the customization object.
Once again - which version of PowerCLI do you use? Get-PowerCLIVersion
Vitali,
PowerCLI team
What OS did you install the vCenter on ?
For a W2K8 server, the logs can be found in C:\ProgramData\VMware\VMware VirtualCenter\Logs
For a W2K3 server, the logs are in C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\Logs
There must be some vpxd logs.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks, I am using the version 264274.
My source template as 1NIC card and customization spec also has 1NIC.
I am not sure where I am getting error. I will post you the error within a day.
Once again thanks for your help.
Yes, it worked perfectly with the script in prod environment. Unable to identify whats the issue. Ok now i modified little more, getting another new error
I need to inform my requirement here,
If i m creating Spec in VC through GUI, i shouldnot pass my domain & domain credentials there. I should pass those info through Set-osspec / through script whenever i am executing. Simple word it should not be constant, bcoz everyone will run this script, so their own credentials needs to be used.
If i am not creating spec through VC (GUI mode), i need to use new-oscustomizationspec, in it i need to pass data. Please assist me.
Script:
Connect-VIServer
Import-Csv c:\Ps\Serverdeploy.csv | %{
$HDDCount = $_.hddcount
$vm = $_.Servername
$hdd2capacity = $_.hdd2capacity
$hdd2datastore = $_.hdd2datastore
$inputportgrp = $_.pysubnet1
$backupsubnet = $_.backupsubnet
$clustername = $_.Clustername
$hdd1datastore = $_.Datastorename
$customizationinput = $_.Customizationname
$CPU = $_.CPU
$memory = $_.Memory
$IP1 = $_.IP1
$Subnet1 = $_.subnet1
$Gateway1 = $_.gateway1
$DNS1 = $_.DNS1
$template = $_.template
$Randomhost = Get-Cluster $clustername | Get-VMHost | get-random
$portgroup = $Randomhost | Get-VirtualPortGroup | select name
$portgroup | ForEach-Object {if ($_.Name -match $inputportgrp) {
$Networkname1 = $_.name
Write-Host $networkname1
}}
$osspec = Get-OSCustomizationSpec
#$osspec | ForEach-Object {if ($_.Name -match $customizationinput) {
#$customizationName = $_.name }}
$customizationName = "windows2k3r2-x64"
Write-Host $customizationName
$hostname = $Randomhost.Name
Write-Host $hostname
$custSpec = New-OSCustomizationSpec -Name Spec2x64 -OSType Windows -Description "This spec adds a computer in a domain." `
-FullName Administrator -OrgName Organization -NamingScheme Fixed -NamingPrefix "Computer" `
-LicenseMode Perserver -LicenseMaxConnections 30 -AdminPassword "" `
-Domain "enterprisenet.org" -DomainUsername "enterprise\sga01" -DomainPassword "Gan@12345"
#Get-OSCustomizationSpec $customizationName | Set-OSCustomizationSpec -FullName $vm -Domain "" -DomainUsername "" -DomainPassword ""
Start-Sleep -Seconds 30
$cus = Get-OSCustomizationNicMapping -spec $custSpec | where { $_.Position -eq '1'} | Set-OSCustomizationNicMapping -IpMode UseStaticIp -IpAddress $ip1 -SubnetMask $subnet1 -DefaultGateway $Gateway1 -Dns $dns1
Write-Host $cus
New-VM -VMhost $hostname -Template $template -Datastore $hdd1datastore -OSCustomizationSpec $custSpec
Start-Sleep -Seconds 900
Get-NetworkAdapter -VM $vm | where {$_.Name -match "1"} | Set-NetworkAdapter -NetworkName $Networkname1
$portgroup | ForEach-Object {if ($_.Name -match $backupsubnet) {
$Networkname2 = $_.name
}
}
#identify NIC counts of VM
$VMinfo = get-vm | where { $_.Name -eq $vm}
$adap = $vminfo | select networkadapters
if no NIC's are present then we need to plan this line
#$adap | % {if((($_.networkadapters).count -lt 1)) {
#Stop-VM $vm
#Start-Sleep -Seconds 120
#New-NetworkAdapter -VM $vm -NetworkName $Networkname1 -StartConnected
#}}
Stop-VM $vm
Start-Sleep -Seconds 120
Set-VM $vm -MemoryMB $Memory -Confirm:$false
Set-VM $vm -NumCpu $CPU -Confirm:$false
$adap | % {if((($_.networkadapters).count -ne 2) -and (($_.networkadapters).count -eq 1)) {
New-NetworkAdapter -VM $vm -NetworkName $Networkname2 -StartConnected
Write-Host "Added Second NIC to the $VM, script will execute after 120 Seconds "
Start-Sleep -Seconds 120
}}
}
Error:
-- BEGIN task-internal-722921 -- -- vmodl.query.PropertyCollector.createFilter -- 6649F3DE-A282-4316-BC92-858D538275BA
-- FINISH task-internal-722921 -- -- vmodl.query.PropertyCollector.createFilter -- 6649F3DE-A282-4316-BC92-858D538275BA
Retrieved host update to 1786682
Retrieved host update to 434310
Default resource used for 'NicSettingMismatch.summary' expected in module 'fault'.
-- FINISH task-258332 -- vm-10726 -- vim.VirtualMachine.clone -- 6649F3DE-A282-4316-BC92-858D538275BA
-- ERROR task-258332 -- vm-10726 -- vim.VirtualMachine.clone: vim.fault.NicSettingMismatch:
(vim.fault.NicSettingMismatch) {
dynamicType = ,
numberOfNicsInSpec = 1,
numberOfNicsInVM = 2,
msg = ""
}
SSLVerifyCertAgainstSystemStore: Subject mismatch: dayesxpabz02.enterprisenet.org vs dayesxpab02z.enterprisenet.org
If you use the '-DomainCredentials (Get-Credentials)' parameter on the Set-OSCustomizationSpec cmdlet instead of the -DomainUsername and the -DomainPassword parameters, the user will be prompted to enter a user/password.
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi Thanks, did you gone through my error. Its telling network mismatch, i am unable to find the reason. Could you assist on it?
Hi again,
the uploaded log says that:
"......
numberOfNicsInSpec = 1,
numberOfNicsInVM = 2,
....."
which means that the VM has two network adapters and the specification has only one and this is the problem. You should add another NicMapping to the specification object using New-OSCustomizationNicMapping cmdlet.
Regards,
Vitali
PowerCLI team
Hi Guys,
Thanks a ton, i am able to deploy VM from excel... But, i am facing few issues like...
1. Unable to Join Domain, although i have entered option / cmd to join domain in new-oscustomization its not working...
2. Also I am unable to run guirunonce command thru NEW-oscustomizationspec....to join domain thru netdom ....
3. Unable to modify memory & CPU, but the command runs & reconfigures. But its not changing value...
Could u please assist,
SCRIPT:
Connect-VIServer nacinwinvc01
Import-Csv c:\Ps\Serverdeploy.csv | %{
$HDDCount = $_.hddcount
$vm = $_.Servername
$hdd2capacity = $_.hdd2capacity
$hdd2datastore = $_.hdd2datastore
$inputportgrp = $_.pysubnet1
$backupsubnet = $_.backupsubnet
$clustername = $_.Clustername
$hdd1datastore = $_.Datastorename
$customizationinput = $_.Customizationname
$CPU = $_.CPU
$memory = $_.Memory
$IP1 = $_.IP1
$Subnet1 = $_.subnet1
$Gateway1 = $_.gateway1
$DNS1 = $_.DNS1
$template = $_.template
$Randomhost = Get-Cluster $clustername | Get-VMHost | get-random
$portgroup = $Randomhost | Get-VirtualPortGroup | select name
$portgroup | ForEach-Object {if ($_.Name -match $inputportgrp) {
$Networkname1 = $_.name
Write-Host $networkname1
}}
$osspec = Get-OSCustomizationSpec
#$osspec | ForEach-Object {if ($_.Name -match $customizationinput) {
#$customizationName = $_.name }}
$customizationName = "windows2k3r2-x64"
Write-Host $customizationName
$hostname = $Randomhost.Name
Write-Host $hostname
New-OSCustomizationSpec -Name spec2k3x64 -OSType Windows -FullName Administrator -OrgName "" -NamingScheme Fixed -NamingPrefix $vm -LicenseMode Perserver -LicenseMaxConnections 30 -ProductKey "" -AdminPassword "password" -AutoLogonCount 2 -Domain "enterprisenet.org" -DomainCredentials (Get-Credential) -DnsServer $DNS1 -GuiRunOnce "netdom.exe 'join /Domain:enterprisenet.org "
#New-OSCustomizationSpec -Name $customizationName -OrgName "" -NamingScheme vm -ProductKey "" -LicenseMaxConnections 5 -AdminPassword "" -TimeZone 040 -OSType windows -FullName "administrator" -Spec -Domain "enterprisenet.org" -DomainUsername "" -DomainPassword "" -ChangeSid
#New-OSCustomizationSpec -Name $customizationName -Spec -OSType windows -FullName $vm -DnsServer $dns1 -OrgName "" -AdminPassword "" -TimeZone 040 -ProductKey "" -LicenseMaxConnections 5 -Domain "" -Domaincredentials (Get-credential) -ChangeSid
#Get-OSCustomizationSpec Spec2x64 | Set-OSCustomizationSpec -FullName $vm -Domain enterprisenet.org -Domaincredentials (Get-Credential)
Start-Sleep -Seconds 30
Get-OSCustomizationNicMapping -spec spec2k3x64 | where { $_.Position -eq '1'} | Set-OSCustomizationNicMapping -IpMode UseStaticIp -IpAddress $ip1 -SubnetMask $subnet1 -DefaultGateway $Gateway1 -Dns $dns1
Write-Host $cus
New-VM -VMhost $hostname -name $vm -Template $template -Datastore $hdd1datastore -OSCustomizationSpec spec2k3x64
Start-Sleep -Seconds 60
Get-NetworkAdapter -VM $vm | where {$_.Name -match "1"} | Set-NetworkAdapter -NetworkName $Networkname1
if no NIC's are present then we need to plan this line
#$adap | % {if((($_.networkadapters).count -lt 1)) {
#Stop-VM $vm
#Start-Sleep -Seconds 120
#New-NetworkAdapter -VM $vm -NetworkName $Networkname1 -StartConnected
#}}
#Verify Server state
$VMinfo = get-vm | where { $_.Name -eq $vm}
$vmstate = $vminfo | %{$_.powerstate}
Write-Host "Server is " $vmstate
if ( $vmstate -match 'poweredoff')
{
Write-Host "Server is down"
}
else
{
Stop-VM $vm
}
Start-Sleep -Seconds 120
$portgroup | ForEach-Object {if ($_.Name -match $backupsubnet) {
$Networkname2 = $_.name
}
}
#identify NIC counts of VM
$VMinfo = get-vm | where { $_.Name -eq $vm}
$adap = $vminfo | select networkadapters
Start-Sleep 60
Set-VM $vm -MemoryMB $Memory -Confirm:$false
Set-VM $vm -NumCpu $CPU -Confirm:$false
$adap | % {if((($_.networkadapters).count -ne 2) -and (($_.networkadapters).count -eq 1)) {
New-NetworkAdapter -VM $vm -NetworkName $Networkname2 -StartConnected
Write-Host "Added Second NIC to the $VM, script will execute after 120 Seconds "
Start-Sleep -Seconds 120
}}
$HDD = Get-HardDisk -vm $vm | select name | Measure-Object -Property name
$hddprop = $HDD | select count
while (($HDDCount -gt $hddprop) -and ($hddcount -eq 2) -and ($hddprop -eq 1) )
{
$vm | New-HardDisk -CapacityKB $hdd2capacity -Persistence persistent -Datastore $hdd2datastore
Start-Sleep -seconds 100
}
while (($HDDCount -gt $hddprop) -and ($hddcount -eq 3) -and ($hddprop -eq 1) )
{
$vm | New-HardDisk -CapacityKB $hdd2capacity -Persistence persistent -Datastore $hdd2datastore
$vm | New-HardDisk -CapacityKB $hdd3capacity -Persistence persistent -Datastore $hdd3datastore
Start-Sleep -Seconds 150
}
while (($HDDCount -gt $hddprop) -and ($hddcount -eq 4) -and ($hddprop -eq 1) )
{
$vm | New-HardDisk -CapacityKB $hdd2capacity -Persistence persistent -Datastore $hdd2datastore
$vm | New-HardDisk -CapacityKB $hdd3capacity -Persistence persistent -Datastore $hdd3datastore
$vm | New-HardDisk -CapacityKB $hdd4capacity -Persistence persistent -Datastore $hdd4datastore
Start-Sleep -Seconds 200
}
while (($HDDCount -gt $hddprop) -and ($hddcount -eq 5) -and ($hddprop -eq 1) )
{
$vm | New-HardDisk -CapacityKB $hdd2capacity -Persistence persistent -Datastore $hdd2datastore
$vm | New-HardDisk -CapacityKB $hdd3capacity -Persistence persistent -Datastore $hdd3datastore
$vm | New-HardDisk -CapacityKB $hdd4capacity -Persistence persistent -Datastore $hdd4datastore
$vm | New-HardDisk -CapacityKB $hdd5capacity -Persistence persistent -Datastore $hdd5datastore
Start-Sleep -Seconds 250
}
Start-VM $vm
Remove-OSCustomizationSpec spec2k3x64 -Confirm:$false
}