Hi all,
I have a very strange issue with powercli command get-vmhost
If I manually type get-vmhost and the fqdn of said host I can retrieve the details
However, if I enter the fqdn into a string variable and use that I receive the following error:
Any ideas as to what is happening?
Many thanks
No problem.
The issue is due to the Select-Object you use.
An object that is produced by Select-Object is not intended for further assignments.
Try changing line 81 to the following.
The ExpandProperty makes sure you will just have the value, not a Select-Object object.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I would need to see what and how you assigned the name to the string variable
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi LucD,
I attach a copy of my script which is working well to retrieve RDM disks from various vcenter servers, you helped me with a lot of this, many thanks for your earlier help and sorry to pester you again with more
Basically I sort the required results into an array called $FinalList and then perform some selections on the array to sort the associated hosts and disk devices into their respective vcenter servers
These variables are then used within a foreach loop where each esxi host info is retrieved using get-vmhost but unfortunately falls over
I attach the script to demonstrate or provide info, it is at line 84 where the array object of the esxihost is placed into the string variable $STRHost using out-string -inputobject
$STRHost = Out-String -InputObject $HostSet
Then I use 'get-vmhost $STRHost' and that is when I receive the error
$LiveHost = Get-VMHost $STRHost
$STRHost | get-member = system.string
I attach my script for your perusal
Many thanks in advance LucD
Sorry but that script only seems to have 77 lines and I don't find a reference to variable LiveHost.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
No problem.
The issue is due to the Select-Object you use.
An object that is produced by Select-Object is not intended for further assignments.
Try changing line 81 to the following.
The ExpandProperty makes sure you will just have the value, not a Select-Object object.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks LucD
That was what I needed