I want to create datastore DS100 and later use following script. where is my fault?
Thanks a lot.
XiongYe
$x=100
foreach ($DS in (Get-vmhost vm-hostname|get-scsilun –luntype disk |select canonicalname)){
New-Datastore -VMHost prme-erqa-002.eng.vmware.com -Name DS-$x -Path $DS
$x=$x+1
}
Try changing
foreach ($DS in (Get-vmhost vm-hostname|get-scsilun –luntype disk |select canonicalname)){
into
foreach ($DS in (Get-vmhost vm-hostname|get-scsilun –luntype disk |select -ExpandProperty canonicalname)){
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Sorry not work...
Does
Get-vmhost vm-hostname|get-scsilun –luntype disk |select -ExpandProperty canonicalname
return anything ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
it return device name which could be used to create datastore, but error not caused by this.
What error message are you getting on the New-Datastore cmdlet ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference