Automation

 View Only
Expand all | Collapse all

Changes in powercli?

  • 1.  Changes in powercli?

    Posted Apr 28, 2020 08:53 AM

    Hi old scripts does not work after upgrading to latest version.

    $vmname = <vm>

    $cluster = Get-cluster -vm $vmname

    has worked so far - but in latest version it retruns error:

    get-cluster : 28-04-2020 10:33:04 Get-Cluster Value cannot be null.

    Parameter name: collection

    Changing to

    $cluster = Get-vm $vmname | get-cluster

    works.

    Same thing observed for Remove-vm command.



  • 2.  RE: Changes in powercli?

    Posted Apr 28, 2020 09:00 AM

    That type of error has been seen before.

    Most of the time it indicates an incorrect installation.

    From which PowerCLI version did you upgrade?
    And to which version?

    Did you follow the steps in Welcome PowerCLI to the PowerShell Gallery – Install Process Updates and more particularly in Updating PowerCLI through the PowerShell Gallery?



  • 3.  RE: Changes in powercli?

    Posted Apr 28, 2020 09:05 AM

    I updated from 11. x to 12.x using update-module command



  • 4.  RE: Changes in powercli?

    Posted Apr 28, 2020 09:19 AM

    And you are sure there are no folders left from a pre-6.5.1 PowerCLI version?

    What does the following show?

    Get-Module -Name VMware* -ListAvailable

    $env:PSModulePath


    As an ultimate procedure, perhaps remove all PowerCLI related folders and do the Install-Module once more.



  • 5.  RE: Changes in powercli?

    Posted Apr 28, 2020 09:28 AM



  • 6.  RE: Changes in powercli?

    Posted Apr 28, 2020 09:37 AM

    And what is in your $env:PSModulePath?

    Does the following work?

    $vmname = <vm>

    $cluster = Get-cluster -Name * -VM $vmname

    This was a working bypass in Re: Get-VM Error after PowerCLI Upgrade



  • 7.  RE: Changes in powercli?

    Posted Apr 28, 2020 09:49 AM

    Seems to be problem on a seperate server - just tested on a server running 11.5 - works - and on another also running 12. 0 - works, so I'll invesitage why this is a local problem just on one installation.



  • 8.  RE: Changes in powercli?

    Posted Apr 28, 2020 09:42 AM

    Btw, I just noticed that you had a similar problem already in PowerCLI 6.5.3

    Re: new-tagassignment value cannot be null

    Was that ever solved (not using the bypass)?



  • 9.  RE: Changes in powercli?

    Posted Apr 28, 2020 09:47 AM

    I rewrote the code to get i working.



  • 10.  RE: Changes in powercli?

    Posted Apr 28, 2020 09:49 AM

    So a similar problem was already present when you migrated to 6.5.3?

    Did you try the -Name * test I posted earlier?



  • 11.  RE: Changes in powercli?

    Posted Apr 28, 2020 09:51 AM

    I have replaced my management server since then - so It's not the same installation.



  • 12.  RE: Changes in powercli?

    Posted Apr 28, 2020 10:00 AM

    Ok, I see.

    Could be useful to completely remove PowerCLI from the problematic server.



  • 13.  RE: Changes in powercli?

    Posted Apr 28, 2020 10:44 AM

    Just rebooted the server - ran my module cleanup script and the it worked - strange.



  • 14.  RE: Changes in powercli?

    Posted Apr 28, 2020 10:49 AM

    That "Value cannot be null" error often points to a botched install or somehow corrupted environment.



  • 15.  RE: Changes in powercli?

    Posted Apr 28, 2020 10:52 AM

    Thanks, nice to know.