When running the Get-SCVirtualDiskDrive command from the VirtualMachineManager module in no particularly special way.
Get-SCVirtualDiskDrive -VMMServer $VMMServer -VM $VMName
I recieve a Common Language Specific (CLS) error
format-default : The field or property: "Lun" for type: "Microsoft.SystemCenter.VirtualMachineManager.VirtualDiskDrive" differs only in letter casing from the field or property: "LUN". The type must be Common Language Specification (CLS) compliant. + CategoryInfo : NotSpecified: (:) [format-default], ExtendedTypeSystemException + FullyQualifiedErrorId : NotACLSComplaintProperty,Microsoft.PowerShell.Commands.FormatDefaultCommand
I am having great difficulty trying to get this command to work from the few tips I can find online about .NET and PowerShell
This line of code works
$method1 = [Microsoft.SystemCenter.VirtualMachineManager.VirtualDiskDrive].GetMethod("get_LUN")
I really expected this line of code to return something but no, it returns nothing ...
$method2 = [Microsoft.SystemCenter.VirtualMachineManager.VirtualDiskDrive].GetMethod("get_Lun")
Beyond getting this line to work, the aim of the script is to expand the virtual machines primary VHD. I am really hoping someone can help here, it is not the first time I have ran into the problem, but this time, it is unavoidable.
The problem is because I am running Powershell version 4 and the virtualmachinemanager module is only compatiable up to version 2.
Leaving two options
Start-Process -File PowerShell.exe -Argument "-Version 2 -noprofile -noexit -file test.ps1 $params"
Not ideal and I hope someone can improve on this answer
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments