dscr-for-vmware
dscr-for-vmware copied to clipboard
Simple configuration fails with InvalidOperation error
Describe the bug
I wrote a simple configuration using vSphereNode under powershell 7.3.6 (powercli and vspheredsc modules are correctly installed and imported. This is the configuration:
Configuration Test {
Import-DscResource -ModuleName VMware.vSphereDSC
vSphereNode 'esxinode.contoso.ar' {
VMHostNtpSettings NTPSettings {
Name = 'esxinode.contoso.ar'
NtpServer = @('10.9.0.1')
NtpServicePolicy = 'on'
}
}
}
Then I call this lines
Connect-ViServer -Server 'esxinode.contoso.ar' -Credential $Credential -force
$dscconfig = New-VmwDscConfiguration -Path .\vmware_dsc.ps1 -Verbose
$dscconfig | Start-VmwDscConfiguration -Verbose
This last line gives me the following error:
InvalidOperation: c:\Users\xxx\Documents\PowerShell\Modules\VMware.PSDesiredStateConfiguration\1.0.0.16\Classes\Public\DscConfigurationRunner.ps1:280
Line |
280 | $moduleVersion = $DscResource.ModuleName.RequiredVersion.ToSt …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| You cannot call a method on a null-valued expression.
I do not know how to debug this situation.
Reproduction steps
The configuration is run against a esxi server (not vcenter). It has a trial license (not expired)
Every time I run Start-VMWdscconfiguration i get this error
Expected behavior
NTP settings configured as desired
Additional context
$PSversiontable is
Name Value
---- -----
PSVersion 7.3.6
PSEdition Core
GitCommitId 7.3.6
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0