Powershell Get-SCVirtualDiskDrive generates a Common Language Specification (CLR) error

beehaus

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.

beehaus

The problem is because I am running Powershell version 4 and the virtualmachinemanager module is only compatiable up to version 2.

Leaving two options

  • Uninstall the Window Management Framework to degrade Powershell to version 2
  • Use Start-Process to run a script as Powershell version 2

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.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Powershell Get-SCVirtualDiskDrive generates a Common Language Specification (CLR) error

From Dev

Is the source code to Common Interpreted Language compiler located within the CLR in .NET

From Dev

Get-LocalGroupMember generates error for Administrators group

From Dev

Language specification for Juttle?

From Dev

Java language specification on wildcards

From Dev

Language specification for Juttle?

From Dev

Powershell to Exchange 2013 - Restricted language mode error

From Dev

Salesforce's APEX language specification

From Dev

What is the markup language specification for umlet?

From Dev

CLR detected an invalid program with powershell

From Dev

CLR detected an invalid program with powershell

From Dev

WebRequest From SQL CLR Error

From Dev

CascadeClassifier in OpenCV generates error

From Dev

Passbook generates PKPass error

From Dev

randomString Function Generates error?

From Dev

Clarification on String Literal based on Java Language Specification

From Dev

Is this a typo in the Scala Language Specification on Parameterized Types?

From Dev

Where can I find SQL language specification

From Dev

Static methods and type parameters in Java Language Specification

From Dev

Where runtime Endianness is defined in the Java Language Specification?

From Dev

How can "[" be an operator in the PHP language specification?

From Dev

how to understand volatile example in Java Language Specification?

From Dev

Mangled nested class namein the Java Language Specification

From Dev

Static methods and type parameters in Java Language Specification

From Dev

Does a formal specification exist for the Groovy programming language?

From Dev

Force PowerShell to use .NET CLR Version 2

From Dev

Force PowerShell to use .NET CLR Version 2

From Dev

PowerShell Get-AzureWebSiteJob error: "git not found"

From Dev

Invalid NEW or OLD specification error

Related Related

  1. 1

    Powershell Get-SCVirtualDiskDrive generates a Common Language Specification (CLR) error

  2. 2

    Is the source code to Common Interpreted Language compiler located within the CLR in .NET

  3. 3

    Get-LocalGroupMember generates error for Administrators group

  4. 4

    Language specification for Juttle?

  5. 5

    Java language specification on wildcards

  6. 6

    Language specification for Juttle?

  7. 7

    Powershell to Exchange 2013 - Restricted language mode error

  8. 8

    Salesforce's APEX language specification

  9. 9

    What is the markup language specification for umlet?

  10. 10

    CLR detected an invalid program with powershell

  11. 11

    CLR detected an invalid program with powershell

  12. 12

    WebRequest From SQL CLR Error

  13. 13

    CascadeClassifier in OpenCV generates error

  14. 14

    Passbook generates PKPass error

  15. 15

    randomString Function Generates error?

  16. 16

    Clarification on String Literal based on Java Language Specification

  17. 17

    Is this a typo in the Scala Language Specification on Parameterized Types?

  18. 18

    Where can I find SQL language specification

  19. 19

    Static methods and type parameters in Java Language Specification

  20. 20

    Where runtime Endianness is defined in the Java Language Specification?

  21. 21

    How can "[" be an operator in the PHP language specification?

  22. 22

    how to understand volatile example in Java Language Specification?

  23. 23

    Mangled nested class namein the Java Language Specification

  24. 24

    Static methods and type parameters in Java Language Specification

  25. 25

    Does a formal specification exist for the Groovy programming language?

  26. 26

    Force PowerShell to use .NET CLR Version 2

  27. 27

    Force PowerShell to use .NET CLR Version 2

  28. 28

    PowerShell Get-AzureWebSiteJob error: "git not found"

  29. 29

    Invalid NEW or OLD specification error

HotTag

Archive