hello together,
whatever i want to run:
Get-VMHost Hostname | Get-StorageViewsReport | Format-Table -auto
Get-StorageViewsReport | Format-Table -auto
etc.
i got an error:
Get-StorageViewsReport : Cannot process argument transformation on parameter 'VM'. Cannot convert the "VMNAME" value of type "VMware.VimAutomation.ViCore.Impl.V1.VM.UniversalVirtualMachineImpl" to type "VMware.VimAutomation.ViCore.Impl.V1.Inventory.VirtualMachineImpl".
At line:1 char:20
+ Get-VMHost HOSTNAME | Get-StorageViewsReport | Format-Table -auto
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-StorageViewsReport], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-StorageViewsReport
i want to see
a) Snapshots on a specific datastore like before in the Storage Monitoring and Reporting missing Plugin
aa) Snapshots of an an specific VM
b) delete the Snapshots via powerCli
Please help
I assume that you are referring to the Get-StorageViewsReport script from KB2112085 ?
If that is the case, the problem is caused by the type declaration for the VM parameter and the fact that you are using PowerCLI 6.3 (you can check by doing a Get-PowerCLIVersion).
The problem, and it's fix, is described in PowerCLI Best Practice: Correct Use of Strong Typing
In short, replace the parameter declarations with
[cmdletbinding(DefaultParameterSetName="ByDatastore")]
param(
[string]$VIServer = "localhost",
[Parameter(ParameterSetName='ByVM')]
[switch]$ByVM,
[Parameter(ValueFromPipeline = $True,
ParameterSetName='ByVM',
ValueFromPipelineByPropertyName=$True,Position=0)]
[VMware.VimAutomation.ViCore.Types.V1.Inventory.VirtualMachine[]]$VM = (Get-VM),
[Parameter(ParameterSetName='ByDatastore')]
[switch]$ByDatastore,
[Parameter(ValueFromPipeline = $True,
ParameterSetName='ByDatastore',
ValueFromPipelineByPropertyName=$True,Position=0)]
[VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.VmfsDatastore[]]$Datastore = (Get-Datastore),
[Parameter(ParameterSetName='ByHost')]
[switch]$ByHost,
[Parameter(ValueFromPipeline = $True,
ParameterSetName='ByHost',Position=0)]
[VMware.VimAutomation.ViCore.Types.V1.Inventory.VMHost[]]$Host = (Get-VMHost)
)
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Now i got the Message
Cannot process argument transformation on parameter 'Datastore'. Cannot convert the "DATASTORENAME" value of type "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.NasDatastoreImpl" to type "VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.VmfsDatastore"
did i forgot something ?
Sorry i am not so familiar with this powercli...
No, but it looks like you are using NFS based datastores.
I don't think that the script was intended for NFS, only VMFS afaik.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
yes only NFS Datastores.
any chance to get the same data via powercli or any other tool like before with the Storage Views tab ?
Not sure if the data is available for NFS datatores, and I can't test right now since I don't have any NFS datastores handy.
But you should be able to test that yourself.
In the script change this line
[VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.VmfsDatastore[]]$Datastore = (Get-Datastore),
by this line
[VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.NasDatastore[]]$Datastore = (Get-Datastore),
and give it a try
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
now i got
Cannot process argument transformation on parameter 'Datastore'. Cannot convert the "Storage1 (1)" value of type "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl" to type "VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.NasDatastore".
Storage1 (1) is the local storage of the ESXi Hosts and not needed / used for VMs etc.
before, i got errors regarding the "real" datastores.
Yes, of course, you get the original error again.
The local disk is not a NFS datastore.
I would like to see the errors for the NFS datastores
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
hello,
with
"[VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.VmfsDatastore[]]$Datastore = (Get-Datastore),"
i got errors
Cannot process argument transformation on parameter 'Datastore'. Cannot convert the "DATASTORENAME" value of type "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.NasDatastoreImpl" to type "VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.VmfsDatastore"
where DATASTORENAME our NFS Datastore is
then i tried your suggestion:
[quote]
change this line
[VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.VmfsDatastore[]]$Datastore = (Get-Datastore),
by this line
[VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.NasDatastore[]]$Datastore = (Get-Datastore),
[/quote]
then i got
Cannot process argument transformation on parameter 'Datastore'. Cannot convert the "Storage1 (1)" value of type "VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl" to type "VMware.VimAutomation.ViCore.Types.V1.DatastoreManagement.NasDatastore".
where STORAGE1 (1) is one of the local storage of an ESXi Host (and not used for VMs )
regards
The script in it's current form can't handle the types that are used by PowerCLI 6.3.
I gave a quick fix by changing the parameter type to, or VmfsDatastore for VMFS datastore, or NasDatastore for NFS datastores.
With neither of the two quick fixes will the script be able to handle a mix of VMFS and NFS datastores, that would require a more fundamental overhaul of the script.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference