Tried that version but getting below error:
Add-Type : c:\Users\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(1) : Invalid token 'string' in class, struct, or interface member declaration
c:\Users\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(1) : >>> public struct LunInfo45625{npublic string ClusterName;
c:\Users\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(2) : public string CanonicalName;
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:29 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\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(5) : Invalid token 'string' in class, struct, or interface member declaration
c:\Users\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(4) : public string DSC;
c:\Users\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(5) : >>> public string SizeGB;ntpublic string ESXi109;ntpublic string ESXi110;n}
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:29 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\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(5) : Invalid token 'string' in class, struct, or interface member declaration
c:\Users\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(4) : public string DSC;
c:\Users\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(5) : >>> public string SizeGB;ntpublic string ESXi109;ntpublic string ESXi110;n}
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:29 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\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(5) : Invalid token '}' in class, struct, or interface member declaration
c:\Users\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(4) : public string DSC;
c:\Users\user\AppData\Local\Temp\14\o4hjkwmg.0.cs(5) : >>> public string SizeGB;ntpublic string ESXi109;ntpublic string ESXi110;n}
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:29 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 D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:29 char:1
+ Add-Type -Language CsharpVersion3 -TypeDefinition $LunInfoDef
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Add-Type], InvalidOperationException
+ FullyQualifiedErrorId : COMPILER_ERRORS,Microsoft.PowerShell.Commands.AddTypeCommand
New-Object : Cannot find type [LunInfo45625]: verify that the assembly containing this type is loaded.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:95 char:8
+ $lun = New-Object ("LunInfo" + $rndNum)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
The property 'ClusterName' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:96 char:1
+ $lun.ClusterName = $ClusterName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'ESXi109' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:99 char:1
+ $lun.$esxName = $_.Value[3]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'CanonicalName' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:100 char:25
+ if(!$lun.CanonicalName){$lun.CanonicalName = $_.Value[0]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'UsedBy' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:101 char:18
+ if(!$lun.UsedBy){$lun.UsedBy = $_.Value[1]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'SizeGB' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:102 char:18
+ if(!$lun.SizeGB){$lun.SizeGB = [math]::Round($_.Value[2],0)}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'DSC' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:103 char:1
+ $lun.DSC = $_.Value[4]
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'ESXi110' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:99 char:1
+ $lun.$esxName = $_.Value[3]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'CanonicalName' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:100 char:25
+ if(!$lun.CanonicalName){$lun.CanonicalName = $_.Value[0]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'UsedBy' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:101 char:18
+ if(!$lun.UsedBy){$lun.UsedBy = $_.Value[1]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'SizeGB' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:102 char:18
+ if(!$lun.SizeGB){$lun.SizeGB = [math]::Round($_.Value[2],0)}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'DSC' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:103 char:1
+ $lun.DSC = $_.Value[4]
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
New-Object : Cannot find type [LunInfo45625]: verify that the assembly containing this type is loaded.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:95 char:8
+ $lun = New-Object ("LunInfo" + $rndNum)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidType: (:) [New-Object], PSArgumentException
+ FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
The property 'ClusterName' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:96 char:1
+ $lun.ClusterName = $ClusterName
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'ESXi109' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:99 char:1
+ $lun.$esxName = $_.Value[3]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'CanonicalName' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:100 char:25
+ if(!$lun.CanonicalName){$lun.CanonicalName = $_.Value[0]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'UsedBy' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:101 char:18
+ if(!$lun.UsedBy){$lun.UsedBy = $_.Value[1]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'SizeGB' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:102 char:18
+ if(!$lun.SizeGB){$lun.SizeGB = [math]::Round($_.Value[2],0)}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'DSC' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:103 char:1
+ $lun.DSC = $_.Value[4]
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'ESXi110' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:99 char:1
+ $lun.$esxName = $_.Value[3]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'CanonicalName' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:100 char:25
+ if(!$lun.CanonicalName){$lun.CanonicalName = $_.Value[0]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'UsedBy' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:101 char:18
+ if(!$lun.UsedBy){$lun.UsedBy = $_.Value[1]}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : PropertyAssignmentException
The property 'SizeGB' cannot be found on this object. Verify that the property exists and can be set.
At D:\script\user\LUN-Mismatch\LUN-Mismatch.ps1:102 char:18