-
1. Re: Finding Lun details using powercli
LucD Jul 20, 2017 5:21 AM (in response to Sureshkumar M)You could run the function against all clusters in your vCenter.
Something like this
Get-Cluster | %{
.\Cluster-LUN-List.ps1 $_.Name
}
-
2. Re: Finding Lun details using powercli
Sureshkumar M Jul 21, 2017 6:56 AM (in response to LucD)Hi,
I tried executing the script and got following error
The property 'ClusterName' cannot be found on this object. Verify that the
property exists and can be set.
At C:\TEMP\Cluster-LUN-List.ps1:61 char:2
+ $lun.ClusterName = $clusName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property '129' cannot be found on this object. Verify that the property
exists and can be set.
At C:\TEMP\Cluster-LUN-List.ps1:64 char:3
+ $lun.$esxName = "ok"
+ ~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property 'CanonicalName' cannot be found on this object. Verify that the
property exists and can be set.
At C:\TEMP\Cluster-LUN-List.ps1:65 char:27
+ if(!$lun.CanonicalName){$lun.CanonicalName = $_.Value[0]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property 'UsedBy' cannot be found on this object. Verify that the propert
exists and can be set.
At C:\TEMP\Cluster-LUN-List.ps1:66 char:20
+ if(!$lun.UsedBy){$lun.UsedBy = $_.Value[1]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyNotFound
The property 'SizeMB' cannot be found on this object. Verify that the propert
exists and can be set.
At C:\TEMP\Cluster-LUN-List.ps1:67 char:20
+ if(!$lun.SizeMB){$lun.SizeMB = $_.Value[2]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
do I need any specific version or powercli to run this script ?
Regards,
Suresh
-
3. Re: Finding Lun details using powercli
LucD Jul 21, 2017 7:09 AM (in response to Sureshkumar M)No, but it looks like the Add-Type didn't work.
Could you eventually attach the .ps1 file you are calling?
There might have been some copy/paste issues
-
4. Re: Finding Lun details using powercli
Sureshkumar M Jul 21, 2017 7:15 AM (in response to LucD)Attached the script.
-
Cluster-LUN-List.ps1.zip 1.0 K
-
-
5. Re: Finding Lun details using powercli
LucD Jul 21, 2017 7:21 AM (in response to Sureshkumar M)Ok, which PowerShell version are you suing?
Display the content of $PSVersionTable
Did you see the following as the first error?
-
6. Re: Finding Lun details using powercli
Sureshkumar M Jul 21, 2017 7:32 AM (in response to LucD)PowerCLI C:\TEMP> $PSVersionTable
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.34014
BuildVersion 6.3.9600.16394
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
Did you see the following as the first error?
I could not grab that info while running, can you let me know how can I redirect the error message to a file to check that please.
-
7. Re: Finding Lun details using powercli
LucD Jul 21, 2017 8:54 AM (in response to Sureshkumar M)You can send the output to a text file.
Start-Transcript -Append -Path C:\Temp\output.txt
Get-Cluster | %{
.\Cluster-LUN-List.ps1 $_.Name 2>&1 | Write-Output
}
Stop-Transcript
-
8. Re: Finding Lun details using powercli
Sureshkumar M Jul 21, 2017 9:52 AM (in response to LucD)Attached output file
-
9. Re: Finding Lun details using powercli
LucD Jul 21, 2017 9:36 AM (in response to Sureshkumar M)Looks like a funny character slipped in during the copy/paste of the code.
The following line seems to indicate that
Invalid token '129' in class, struct, or interface member declaration
Try with the attached .ps1 file instead
-
Cluster-LUN-List.ps1.zip 1.0 K
-
-
10. Re: Finding Lun details using powercli
Sureshkumar M Jul 21, 2017 9:51 AM (in response to LucD)Attached new output file. Still could not run.
-
output.txt.zip 1.8 K
-
-
11. Re: Finding Lun details using powercli
LucD Jul 21, 2017 10:04 AM (in response to Sureshkumar M)Do you happen to have ESXi nodes that have an IP address as the hostname?
-
12. Re: Finding Lun details using powercli
Sureshkumar M Jul 21, 2017 10:07 AM (in response to LucD)No, we have only two hosts in the VC and none of them has IP as the hostname.
-
13. Re: Finding Lun details using powercli
LucD Jul 21, 2017 10:16 AM (in response to Sureshkumar M)What does this return?
Get-Cluster -Name CLuster01 | Get-VMHost
-
14. Re: Finding Lun details using powercli
Sureshkumar M Jul 21, 2017 10:26 AM (in response to LucD)It returns the IP address of the ESXi hosts, one thing I forgot to mention, the hosts are connected using IP to VC instead of hostname. Would that cause this issue ?