VMware Cloud Community
Christos_V
Contributor
Contributor
Jump to solution

Please help to correct below

 

pooldesktop
tst1rtyui
tst2dfgty

 

$test = import-csv C:\Users\tst\Desktop\pool.csv

$test1=@($test)

foreach($ts in $test1)

{
New-HVPool -InstantClone -PoolName "$ts.pool" -PoolDisplayName "$ts.pool" -Description "create testpoolps" -UserAssignment FLOATING -Vcenter vc.tst.com -ParentVM 'testvm' -SnapshotVM '12' -VmFolder 'Desktops' -HostOrCluster '11a' -ResourcePool 'Desktops' -NamingMethod PATTERN --Datastores 'D00893TB' -NamingPattern "$ts.desktop" -NetBiosName eentst -DomainAdmin root

}

Exception calling "Desktop_Create" with "2" argument(s): "ExceptionType : VMware.Hv.InvalidArgument
ErrorMessage : Invalid value for member
ParameterName : base.name"
At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:4986 char:7

  •   $id = $desktop_helper.Desktop_create($services,$desktopSpecObj)
  •   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [], MethodInvocationException
    • FullyQualifiedErrorId : VimException
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try replacing

"$ts.pool"

with

"$($ts.pool)"

Similar for $ts.desktop


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

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

Try replacing

"$ts.pool"

with

"$($ts.pool)"

Similar for $ts.desktop


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

Christos_V
Contributor
Contributor
Jump to solution

Thanks .It works

0 Kudos