I've used powerCLI before, I'm not a complete n00b, but I seem to be missing something fairly simple with this script.
http://www.vtagion.com/automate-install-embedded-host-client-esxi-fling-hosts-cluster/
I grabbed it from the author's github page, and saved it locally to the root of D. I set my execution policy to unrestricted, connected to my lab vcenter server, imported the script as a module and tried running it.
It prompts me for each piece of info if I just give the Install-HostClient command, but it complains each time about
install-HostClient : Cannot process argument transformation on parameter
'Datastore'. Cannot convert the "DATASTORE01" value of type "System.String" to
type
"VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.NasDatastoreImpl".
At line:1 char:1
+ install-HostClient
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [install-HostClient], Parameter
BindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,install-Hos
tClient
Since this is a VMFS datastore I figured the NasDatastoreImpl portion of the script was the issue so I changed that to VmfsDatastoreImpl, removed the module, re-imported the new version and tried again, but just got the same error just referring to Vmfs now.
What am I missing with this?
Thanks
It seems you have to provide a datastore object (the object that come s out of Get-Datastore), not the string with the name of the datastore.
That is exactly what Brian is doing in his post as well.
install-HostClient -Datastore (Get-Datastore NFS-SAS-300GB-A) ....
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
get-datastore gives the name of the datastore as I have input it when prompted. That's what confuses me.
Get-Datastore returns an object, and the datastorename is one of the properties of that object.
Did you try passing the object instead of the string ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I'm not clear on what you mean by that, but when I do as the article mentions filling in all details in a single command I get a >> prompt and no progress.
PowerCLI D:\> install-HostClient -Datastore (Get-Datastore DATASTORE01) -Cluster (Ge
t-Cluster 'cluster') -vibfullpath 'D:\esxui_signed.vib
>>
PowerShell expects more input from you.
You didn't close the string you started with 'D:\esxui...
You have to put the closing quote at the end
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
got it, correct. However, similar error after closing the quote.
PowerCLI D:\> install-HostClient -Datastore (Get-Datastore DATASTORE01) -Cluster (Ge
t-Cluster 'cluster') -vibfullpath 'D:\esxui_signed.vib'
install-HostClient : Cannot process argument transformation on parameter
'Datastore'. Cannot convert the "DATASTORE01" value of type
"VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl" to
type
"VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.NasDatastoreImpl".
At line:1 char:31
+ install-HostClient -Datastore (Get-Datastore DATASTORE01) -Cluster (Get-Cluster
'int ...
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [install-HostClient], Parameter
BindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,install-Hos
tClient
That seems to be caused by the parameter definition in the function Install-Hostclient.
The parameter Datastore is defined as type VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.NasDatastoreImpl, while your datastore is of type VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl.
Change the type of the parameter in the function to fit your datastore type.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
ok, maybe I'm a n00b then :smileylaugh:
I thought the same thing you're saying, I am trying to access a VMFS datastore, so the parameter should reference that and not NAS.
However, my understanding of how to remedy that is where I'm lost.
I added
[VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl]
to InstallHostClient.ps1 imported that as a module and tried it again, but got the same error now referenceing VMFS not being able to be processed;
install-HostClient : Cannot process argument transformation on parameter
'Datastore'. Cannot convert the "DATASTORE01" value of type "System.String" to
type
"VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl".
At line:1 char:1
+ install-HostClient
+ ~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [install-HostClient], Parameter
BindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,install-Hos
tClient
No, that is not the same message.
Now you are again trying to passa string to the Datastore parameter.
Did you do a Get-Datastore and pass the returned object to the function ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I tried both ways; walking through the prompts after issuing just the install-hostclient command, and issuing it as one big command.
PowerCLI C:\Users\dsohayda\Desktop> install-HostClient -Datastore (Get-Datastore
DATASTORE01) -Cluster (Get-Cluster 'cluster') -vibfullpath 'D:\esxui_signed.v
ib'
install-HostClient : Cannot process argument transformation on parameter
'Datastore'. Cannot convert the "DATASTORE01" value of type
"VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.VmfsDatastoreImpl" to
type
"VMware.VimAutomation.ViCore.Impl.V1.DatastoreManagement.NasDatastoreImpl".
At line:1 char:31
+ install-HostClient -Datastore (Get-Datastore DATASTORE01) -Cluster (Get-Cluster
'int ...
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [install-HostClient], Parameter
BindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,install-Hos
tClient
Unless you mean something else by passing the returned object...
That is back the error with the type of the parameter Datastore on the Install-HostClient function.
Did you change the type in the function ?
The error message seems to say you didn't
Perhaps it's easier if you attach the .ps1 file you are running.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Could my issues be related to importing the module when it was set to look for NAS storage and then trying to re-import it? Maybe I did that incorrectly?
It seems like, as you are saying, it never got the updated module with the VMFS storage change made to the script.
How should I have done that?
I have attached the file I am trying to use.
Thank you for your continued help with this.
I still see a line with NasDatastoreImpl] in the parameter definition, remove that part (everything between, and including, the square brackets.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
ok, so I thought I did try just as you recommended, and removed the NasDatastoreImpl parameter before, but apparently not.
I did so and this time the command ran, unfortunately I ran into a new issue I do not understand. The script states that it should copy the vib file to the datastore, but in my case it did not, and it made no mention of it failing to copy as the script says it should on the 'validate the copy worked' section.
I tried moving the vib to my desktop as well, but same errors.
PowerCLI C:\Users\user01\Desktop> install-HostClient -Datastore (Get-Datastore
DATASTORE01) -Cluster (Get-Cluster 'intel cluster') -vibfullpath 'D:\esxui_signed.v
ib'
Preparing labhost10.LAB.local for ESXCLI
Installing ESXi Embedded Host Client on labhost10.LAB.local
Message: [VibDownloadError];
InnerText: [VibDownloadError] ('/vmfs/volumes/DATASTORE01/esxui_signed.vib', '',
"[Errno 4] IOError: <urlopen error [Errno 2] No such file or directory:
'/vmfs/volumes/DATASTORE01/esxui_signed.vib'>") url =
/vmfs/volumes/DATASTORE01/esxui_signed.vib Please refer to the log file for more
details.EsxCLI.CLIFault.summary
At C:\Users\user01\Desktop\InstallHostClient2.ps1:97 char:9
+ $action =
$ESXCLI.software.vib.install($null,$null,$null,$null,$null,$nu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : OperationStopped: (:) [], ViError
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.
VimException.ViError
Preparing labhost01.LAB.local for ESXCLI
Installing ESXi Embedded Host Client on labhost01.LAB.local
Message: [VibDownloadError];
InnerText: [VibDownloadError] ('/vmfs/volumes/DATASTORE01/esxui_signed.vib', '',
"[Errno 4] IOError: <urlopen error [Errno 2] No such file or directory:
'/vmfs/volumes/DATASTORE01/esxui_signed.vib'>") url =
/vmfs/volumes/DATASTORE01/esxui_signed.vib Please refer to the log file for more
details.EsxCLI.CLIFault.summary
At C:\Users\user01\Desktop\InstallHostClient2.ps1:97 char:9
+ $action =
$ESXCLI.software.vib.install($null,$null,$null,$null,$null,$nu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : OperationStopped: (:) [], ViError
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.
VimException.ViError
Preparing labhost02.LAB.local for ESXCLI
Installing ESXi Embedded Host Client on labhost02.LAB.local
Message: [VibDownloadError];
InnerText: [VibDownloadError] ('/vmfs/volumes/DATASTORE01/esxui_signed.vib', '',
"[Errno 4] IOError: <urlopen error [Errno 2] No such file or directory:
'/vmfs/volumes/DATASTORE01/esxui_signed.vib'>") url =
/vmfs/volumes/DATASTORE01/esxui_signed.vib Please refer to the log file for more
details.EsxCLI.CLIFault.summary
At C:\Users\user01\Desktop\InstallHostClient2.ps1:97 char:9
+ $action =
$ESXCLI.software.vib.install($null,$null,$null,$null,$null,$nu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~
+ CategoryInfo : OperationStopped: (:) [], ViError
+ FullyQualifiedErrorId : VMware.VimAutomation.Sdk.Types.V1.ErrorHandling.
VimException.ViError
Preparing labhost09.LAB.local for ESXCLI
It appears ESX-UI is already installed on labhost09.LAB.local. Skipping...
Function Complete
You may access your hosts at https://<host ipaddress>/ui
PowerCLI C:\Users\user01\Desktop>
It looks as if datastore DATASTORE01 i snot known on at least one the ESXi nodes in the cluster.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
that datastore is definitely known by all the hosts in the cluster. It's a small 4 host cluster, and looking at the hosts tab with the datastore selected shows all 4 hosts with a state of connected.
I tried multiple datastores that are connected to all the hosts with the same results. Since they're all part of a datastore cluster could it be a matter of needing to specify that information too?
it seems like the script is just skipping the part where it's supposed to copy the file though. you can see immediately after issuing the command it goes to the part where it prepares the host for installation. No mention of copying the file to the datastore...
PowerCLI C:\Users\user01\Desktop> install-HostClient -Datastore (Get-Datastore
DATASTORE01) -Cluster (Get-Cluster 'intel cluster') -vibfullpath 'D:\esxui_signed.v
ib'
Preparing labhost10.LAB.local for ESXCLI
Installing ESXi Embedded Host Client on labhost10.LAB.local