bvi1006
Enthusiast
Enthusiast

Get-Compliance crashes Powershell

Hi,

I have been trying to run Get-Compliance to get information from our Update Manager 5.1 U2. When I execute the command it crashes Powershell. Are these versions not compatible?

Thanks!

All module versions are listed here:

PS C:\Windows\system32> Get-PowerCLIVersion

PowerCLI Version

----------------

VMware vSphere PowerCLI 5.1 Release 1 build 793510

---------------

Snapin Versions

---------------

   VMWare AutoDeploy PowerCLI Component 5.1 build 768137

   VMWare ImageBuilder PowerCLI Component 5.1 build 768137

   VMware License PowerCLI Component 5.1 build 669840

   VMware vSphere PowerCLI Component 5.1 build 793489

   VMware vSphere Update Manager PowerCLI 5.1 build 782803

Powershell Version

Major  Minor  Build  Revision

-----  -----  -----  --------

4      0      -1     -1     

LucD
Leadership
Leadership

Try starting PowerShell with

powershell -version 2


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
bvi1006
Enthusiast
Enthusiast

Thanks Luc. I'm not even sure where I'd find 2.0 at this point..

I had .NET 4.5.1 installed and have now upgraded to 4.5.2. In the release notes(Exceptions in Windows PowerShell, other dynamic languages, and dynamically executed C# code when cod...) it suggests to do the following if your still have issues:

Add a cast to System.Type within the call to method SizeOf or method PtrToStructure. For example:

$size = [System.Runtime.InteropServices.Marshal]::SizeOf([System.Type] $type)

$obj = [System.Runtime.InteropServices.Marshal]::PtrToStructure($ptr, [System.Type] $type)

Trouble is, I have no idea what this is :smileyconfused: ... do you ?

Thanks!

Reply
0 Kudos
LucD
Leadership
Leadership

When you have installed PowerShell v3 or V4, you can run it in version 2 mode.

From a command prompt, just type

powershell -version 2


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

bvi1006
Enthusiast
Enthusiast

:slightly_smiling_face: :slightly_smiling_face: :slightly_smiling_face: thanks !

Reply
0 Kudos
squebel
Contributor
Contributor

This worked for me as well. Thanks, Luc!

Reply
0 Kudos
sprowe73
Contributor
Contributor

this works,but is there a fix in the works for this. I have to re-write some of my script to get it to work in version 2.

thx,

Scott

Reply
0 Kudos