1 2 Previous Next 16 Replies Latest reply on Aug 8, 2019 9:14 AM by ddmunhoz

    Get-Vm : Value cannot be null

    ChristianG Novice

      With PowerCli 11, I got Value cannot be null

       

      Get-Vm : Value cannot be null.

      Parameter name: format

      At line:1 char:1

      + Get-Vm *

      + ~~~~~~~~

          + CategoryInfo          : NotSpecified: (:) [Get-VM], ArgumentNullException

          + FullyQualifiedErrorId : System.ArgumentNullException,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

       

       

      I got this error on almost all commands.

      After some digging, I got this error only if I change windows display language (in my case from french to english). Currently running Windows 10 1709

       

      Could anyone can confirm this a bug with PowerCLI?

        • 1. Re: Get-Vm : Value cannot be null
          ChristianG Novice

          Full error is

          PSMessageDetails      :

          Exception             : System.ArgumentNullException: Value cannot be null.

                                  Parameter name: format

                                     at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)

                                     at

                                  VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.MessageHelper.ThrowTerminatingError(Exception ex,

                                  String connectionId)

                                     at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()

                                     at VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM.ProcessRecordErrorHandled()

                                     at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ErrorCallbackCmdletBase.ProcessRecord()

                                     at System.Management.Automation.CommandProcessor.ProcessRecord()

          TargetObject          :

          CategoryInfo          : NotSpecified: (:) [Get-VM], ArgumentNullException

          FullyQualifiedErrorId : System.ArgumentNullException,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

          ErrorDetails          :

          InvocationInfo        : System.Management.Automation.InvocationInfo

          ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1

          PipelineIterationInfo : {}

           

          MyCommand             : Get-VM

          BoundParameters       : {}

          UnboundArguments      : {}

          ScriptLineNumber      : 1

          OffsetInLine          : 1

          HistoryId             : 11

          ScriptName            :

          Line                  : Get-Vm *

          PositionMessage       : At line:1 char:1

                                  + Get-Vm *

                                  + ~~~~~~~~

          PSScriptRoot          :

          PSCommandPath         :

          InvocationName        : Get-Vm

          PipelineLength        : 0

          PipelinePosition      : 0

          ExpectingInput        : False

          CommandOrigin         : Internal

          DisplayScriptPosition :

           

          00000000000000000000000000000000000000000000000000000000000000000000000000000000

           

          Message        : Value cannot be null.

                           Parameter name: format

          ParamName      : format

          Data           : {}

          InnerException :

          TargetSite     : System.String FormatHelper(System.IFormatProvider, System.String, System.ParamsArray)

          StackTrace     :    at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)

                              at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.MessageHelper.ThrowTerminatingError(Exception ex,

                           String connectionId)

                              at VMware.VimAutomation.ViCore.Util10Ps.BaseCmdlet.BaseCmdlet.ProcessRecordErrorHandled()

                              at VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM.ProcessRecordErrorHandled()

                              at VMware.VimAutomation.Sdk.Util10Ps.BaseCmdlet.ErrorCallbackCmdletBase.ProcessRecord()

                              at System.Management.Automation.CommandProcessor.ProcessRecord()

          HelpLink       :

          Source         : mscorlib

          HResult        : -2147467261

          • 2. Re: Get-Vm : Value cannot be null
            LucD Guru
            User ModeratorsvExpertCommunity Warriors

            Are you running this in PowerShell v5.1 or v6.*?

             

            Could it be that you have some 'unknown' VMs in your environment?

            See Get-VM Error after PowerCLI Upgrade

             

            Does this return correctly?

             

            Get-VM -Name *

             

            • 3. Re: Get-Vm : Value cannot be null
              ChristianG Novice

              Hello,

               

              Using PowerShell 5.1.

               

              Get-VM -Name * print correctly then I got the error

              Get-Vm : Value cannot be null.

              Parameter name: format

              At line:1 char:1

               

              If I do $vms = Get-VM -Name *

              $vms is null

               

              If I switch Windows display language to french (original install language), command Get-VM -Name * run without error.

              I did not have the issue on Windows 2016 FR with English display language.

              • 4. Re: Get-Vm : Value cannot be null
                LucD Guru
                Community WarriorsvExpertUser Moderators

                Can you check if there are any "funny" VMs in the environment?

                Check with

                 

                $sView = @{

                    ViewType = 'VirtualMachine'

                    Property = 'Name','Runtime.ConnectionState'

                    Filter = @{'Runtime.ConnectionState' = "$((1..4 | %{[VMware.Vim.VirtualMachineconnectionstate]$_}) -join '|')"}

                }

                Get-View @sView | Select Name,@{N='ConnectionState';E={$_.Runtime.ConnectionState}}

                • 5. Re: Get-Vm : Value cannot be null
                  ChristianG Novice

                  It return no result. Good?

                  • 6. Re: Get-Vm : Value cannot be null
                    LucD Guru
                    User ModeratorsvExpertCommunity Warriors

                    Yes, that means that are no VMs in a funny state in the environment.

                     

                    You could try to update your PowerCLI version to 11.0.0.
                    This issue was reported some time ago, and the latest version might contain a fix.

                     

                    If not, i would advise to a open a SR for the issue.

                    • 7. Re: Get-Vm : Value cannot be null
                      ChristianG Novice

                      I am already using PowerCLI 11

                      • 8. Re: Get-Vm : Value cannot be null
                        LucD Guru
                        Community WarriorsUser ModeratorsvExpert

                        Then I would suggest to open a SR, because this looks like a possible "bug".

                        And yes, PowerCLI is supported and does not require you to have a Developer Support contract.

                        See PowerCLI Support Breakdown

                        • 9. Re: Get-Vm : Value cannot be null
                          Jrt1general Novice

                          I can confirm I'm also having this issue specifically with vCenter 6.7x. I've tested the same code on 6.0 and earlier without fail. When I target 6.7 - I get the dreaded Value cannot be Null.

                           

                          It breaks all sorts of scripts in my environment. Mostly stuff automated to make my life easier not my customers. Nothing like slamming the brakes on a upgrade plan...

                          • 10. Re: Get-Vm : Value cannot be null
                            LucD Guru
                            User ModeratorsCommunity WarriorsvExpert

                            Just tried again against 6.7 U1b with PowerCLI 11.2.0, no problem.
                            Which PowerCLI version are you using?

                            • 11. Re: Get-Vm : Value cannot be null
                              Jrt1general Novice

                              PowerCLI 11.2.0 with 6.7U1b

                               

                              I'm going to spin up a Win10 VM with no domain GPos or customizations and try again - I need to find the cause of this!

                               

                              Thanks again for testing and reporting back. It gives me hope.

                              • 12. Re: Get-Vm : Value cannot be null
                                JeanFrancoisT Lurker

                                We have the same "language problem" here, using the latest PowerCLI. We are using Windows 10 French and we customize the OS as French (Canada). But (just like the SQL installers), unless we change the region/language to French (France), it doesnt work and we get the "Value cannot be null." error message.

                                • 13. Re: Get-Vm : Value cannot be null
                                  Ukusic Novice

                                  I have something similar but with New-VM

                                   

                                  PowerCLI 11.2.0 with 6.7U1b

                                   

                                  Simple test: (i have replaced the true values in this text)

                                   

                                  PS> Connect-VIServer <vcenter>

                                  PS> New-VM -Name <servername> -Datastore <datastore-clustername> -ResourcePool <clustername>

                                  New-VM : 2019-03-12 10:10:19    New-VM        Value cannot be null.

                                  Parameter name: source

                                  At line:1 char:1

                                  + New-VM -Name <servername> -Datastore <datastore-clustername> -ResourcePool <clustername>

                                  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                                      + CategoryInfo          : NotSpecified: (:) [New-VM], VimException

                                      + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.NewVM

                                   

                                   

                                  Same command with PowerCLI 11.1.0 with 6.7U1b works and creates a virtual machine without problem.


                                  In my tests i have downloaded the zips for both 11.1 and 11.2 from here VMware PowerCLI - VMware {code}  and unpacked in C:\Program Files\WindowsPowerShell\Modules\ bc we are offline, one at a time during the tests.

                                  • 14. Re: Get-Vm : Value cannot be null
                                    zik Enthusiast

                                    I solved this by adding "-Portgroup $pg".  A network seems to be required now.

                                    1 2 Previous Next