In that script the parameter vmList is defined as mandatory.
So you will have to provide that parameter$vms = Get-VM -Name vm1,vm2,vm3
.\Clone_VM.ps1 -vmList $vmsBlog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
I would like to mention the parameters inside the script rather than mentioning outside while running.
Please help in changing that.
You would need to take away the 'mandatory' part of the parameter definition.
And assign a value inside the script.
The first couple of lines could look like this[CmdletBinding()]
# VMs to monitor for OS customization completion
[VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine] $vmList = (Get-VM -Name vm1,vm2,vm3),
# timeout in seconds to wait
[int] $timeoutSeconds = 600
But to be honest, if you don't want to use parameters when calling the script, you can just as well leave out the complete Param part.
And just do the following at the beginning of the script.$vmList = Get-VM -Name vm1,vm2,vm3
$timeoutSeconds = 600Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
Thank you very much LucD.
That worked perfect