Hello,
I found a LUN report here: LUN report - datastore, RDM and node visibility - LucD notes . I noticed in comments on the page, it was suggested to change the ; to any other character, but I am still getting an error.
I tried changing $LunInfoDef += ("`n`tpublic string " + ($_.Name.Split(".")[0]) + ";")
to $LunInfoDef += ("`n`tpublic string " + ($_.Name.Split(".")[0]) + "*") <---- asterisk instead of semi-colon
I copied the script and attempted a run, creating the variable for the $clusName, but I am getting an error during the run. Below is the version of PS, PowerCLI I am on. Further down is the error output.
PS Version
Name Value
---- -----
PSVersion 5.1.16299.1146
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.1146
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
PowerCLI Version
----------------
VMware PowerCLI 11.2.0 build 12483598
---------------
Component Versions
---------------
VMware Cis Core PowerCLI Component PowerCLI Component 11.2 build 12483642
VMware VimAutomation VICore Commands PowerCLI Component PowerCLI Component 11.2 build 12483638
VMware VimAutomation Srm PowerCLI Component PowerCLI Component 11.2 build 12483605
VMware VimAutomation License PowerCLI Component PowerCLI Component 10.0 build 7893904
VMware VimAutomation Vds Commands PowerCLI Component PowerCLI Component 11.2 build 12483615
VMware Vmc PowerCLI Component PowerCLI Component 11.2 build 12483614
VMware Nsxt PowerCLI Component PowerCLI Component 11.2 build 12483633
VMware VimAutomation vROps PowerCLI Component PowerCLI Component 10.0 build 7893921
VMware HorizonView PowerCLI Component 7.1.0 build 12680098
VMware VimAutomation Cloud PowerCLI Component PowerCLI Component 11.0 build 10379994
VMWare ImageBuilder PowerCLI Component 6.7 build 11233116
VMWare AutoDeploy PowerCLI Component 6.7 build 11233116
VMware VimAutomation Storage PowerCLI Component PowerCLI Component 11.2 build 12483611
VMware vSphere Update Manager PowerCLI 6.5 build 7862888
VMware VimAutomation Security PowerCLI Component PowerCLI Component 11.0 build 10380515
VMware Hcx PowerCLI Component PowerCLI Component 11.2 build 12483619
ERROR
Add-Type : c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(6) : ; expected
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(5) : public string SizeMB;
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(6) : >>> public string esxi-host;
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(7) : public string esxi-host2;
At C:\Users\\Documents\WindowsPowerShell\Scripts\lunrpt.ps1:16 char:1
+ Add-Type -Language CsharpVersion3 -TypeDefinition $LunInfoDef
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(6) : Invalid token ';' in class, struct, or interface member declaration
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(5) : public string SizeMB;
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(6) : >>> public string esxi-host;
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(7) : public string esxi-host2;
At C:\Users\\Documents\WindowsPowerShell\Scripts\lunrpt.ps1:16 char:1
+ Add-Type -Language CsharpVersion3 -TypeDefinition $LunInfoDef
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(7) : ; expected
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(6) : public string esxi-host;
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(7) : >>> public string esxi-host2;
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(8) : }
At C:\Users\\Documents\WindowsPowerShell\Scripts\lunrpt.ps1:16 char:1
+ Add-Type -Language CsharpVersion3 -TypeDefinition $LunInfoDef
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(7) : Invalid token ';' in class, struct, or interface member declaration
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(6) : public string esxi-host;
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(7) : >>> public string esxi-host2;
c:\Users\\AppData\Local\Temp\qb1ucdbb.0.cs(8) : }
At C:\Users\\Documents\WindowsPowerShell\Scripts\lunrpt.ps1:16 char:1
+ Add-Type -Language CsharpVersion3 -TypeDefinition $LunInfoDef
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (Microsoft.Power...peCompilerError:AddTypeCompilerError) [Add-Type], Exception
+ FullyQualifiedErrorId : SOURCE_CODE_ERROR,Microsoft.PowerShell.Commands.AddTypeCommand
Add-Type : Cannot add type. Compilation errors occurred.
At C:\Users\\Documents\WindowsPowerShell\Scripts\lunrpt.ps1:16 char:1
+ Add-Type -Language CsharpVersion3 -TypeDefinition $LunInfoDef
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException
+ FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand