從VirtualMachineManager模塊以毫無特別的方式運行Get-SCVirtualDiskDrive命令時。Powershell Get-SCVirtualDiskDrive生成通用語言規範(CLR)錯誤
Get-SCVirtualDiskDrive -VMMServer $VMMServer -VM $VMName
我收到公共語言特定(CLS)錯誤
格式默認:該字段或屬性:「倫」類型:「Microsoft.SystemCenter.VirtualMachineManager.VirtualDiskDrive」在信唯一不同外殼 或屬性:「LUN」。該類型必須符合公共語言規範(CLS)。 + CategoryInfo:NotSpecified:(:) [格式默認],ExtendedTypeSystemException + FullyQualifiedErrorId:NotACLSComplaintProperty,Microsoft.PowerShell.Commands.FormatDefaultCommand
我有試圖讓這個命令從一些提示,工作難度很大我可以對.NET和PowerShell
這行代碼在網上找到工作
$method1 = [Microsoft.SystemCenter.VirtualMachineManager.VirtualDiskDrive].GetMethod("get_LUN")
我真的希望這行代碼返回的東西,但沒有,它沒有返回值...
$method2 = [Microsoft.SystemCenter.VirtualMachineManager.VirtualDiskDrive].GetMethod("get_Lun")
除了讓這條線路正常工作外,腳本的目標是擴展虛擬機的主要VHD。我真的希望有人能在這裏幫助,這不是我第一次遇到問題,但這一次,這是不可避免的。