Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

WindowsOptionalFeature: Get Method fails if OptionalFeature has no custom properties when called by the LCM. #191

Open
jambar42 opened this issue Jul 27, 2020 · 0 comments · May be fixed by #192

Comments

@jambar42
Copy link

jambar42 commented Jul 27, 2020

When the WindowsOptionalFeature DSC resource Get method is invoked by the LCM, an error is thrown if the Optional Feature has no custom properties.

Optional Feature with Custom Properties:
PS C:\Windows\system32> Invoke-DscResource -Name "WindowsOptionalFeature" -Method Get -ModuleName "PSDSCResources" -Property @{Name = "SystemDataArchiver"; Ensure = 'Present'}

ConfigurationName :
DependsOn :
ModuleName : PSDSCResources
ModuleVersion : 2.9.0.0
PsDscRunAsCredential :
ResourceId :
SourceInfo :
CustomProperties : {Name = Description, Value = Provides services to collect and archive Windows Server system
data., Path = ServerComponent, Name = DisplayName, Value = System Data Archiver, Path =
ServerComponent, Name = Id, Value = 1043, Path = ServerComponent, Name = Type, Value = Feature,
Path = ServerComponent...}
Description : Provides services to collect and archive Windows Server system data.
DisplayName : System Data Archiver
Ensure : Present
LogLevel : WarningsInfo
LogPath : C:\Windows\Logs\DISM\dism.log
Name : SystemDataArchiver
NoWindowsUpdateCheck :
RemoveFilesOnDisable :
PSComputerName : localhost
BeforeChangeWithCustomProperties

Optional Feature without Custom Properties:
PS C:\Windows\system32> Invoke-DscResource -Name "WindowsOptionalFeature" -Method Get -ModuleName "PSDSCResources" -Property @{Name = "HypervisorPlatform"; Ensure = 'Present'}
A general error occurred that is not covered by a more specific error code.
+ CategoryInfo : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : MI RESULT 1
+ PSComputerName : localhost
BeforeChangeWithoutCustomProperties

Windows\Desired State Configuration Event Error 4250 thrown:
Job {FCA666F0-D06E-11EA-AD33-248A07A40AF1} :
Message Specified cast is not valid.
HResult -2147467262
StackTrack at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DownloadManagerBase.ConvertCimInstanceToHashTable(CimInstance cimInstance, Boolean bWrap)
at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DownloadManagerBase.ConvertCimInstanceToHashTable(CimInstance cimInstance, Boolean bWrap)
at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DownloadManagerBase.ConvertCimInstanceToHashTable(CimInstance cimInstance, Boolean bWrap)
at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DownloadManagerBase.GetJsonStringArrayStatusValue(Object value, IntPtr& statusInstanceHandle, UInt32& getActionStatusCode)
at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DownloadManagerBase.AddSendStatusParametersFromStatusInformation(PowerShell powershell, IntPtr statusInformationPtr, UInt32 reportType, IntPtr& errorInstanceHandle, UInt32& getActionStatusCode)
at Microsoft.PowerShell.DesiredStateConfiguration.Internal.DownloadManagerBase.SendStatusReport(IntPtr metaConfigHandle, IntPtr& errorInstanceHandle, IntPtr statusInformation, UInt32 reportType, UInt32& getActionStatusCode)
DSCEvent4250

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
1 participant