Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSCParser error when generating reports. #4676

Closed
Kimhal opened this issue May 15, 2024 · 11 comments
Closed

DSCParser error when generating reports. #4676

Kimhal opened this issue May 15, 2024 · 11 comments

Comments

@Kimhal
Copy link

Kimhal commented May 15, 2024

Description of the issue

When I run the following command.
New-M365DSCReportFromConfiguration -Type 'Excel' -ConfigurationPath 'D:\Microsoft365DSC\Configuration.ps1' -OutputPath 'D:\Microsoft365DSC\Report.xlsx'
I receive the this error:
**Cannot index into a null array.
At C:\Program Files\WindowsPowerShell\Modules\DSCParser\2.0.0.4\Modules\DSCParser.psm1:420 char:9

  •     $resourceType         = $resource.CommandElements[0].Value
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                                        
         + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
         + FullyQualifiedErrorId : NullArray**
    

Microsoft 365 DSC Version

1.24.515.1

Which workloads are affected

other

The DSC configuration

No response

Verbose logs showing the problem

No response

Environment Information + PowerShell Version

OsName               : Microsoft Windows 11 Enterprise
OsOperatingSystemSKU : EnterpriseEdition
OsArchitecture       : 64-bit
WindowsVersion       : 2009
WindowsBuildLabEx    : 22621.1.amd64fre.ni_release.220506-1250
OsLanguage           : da-DK
OsMuiLanguages       : {da-DK, en-US}
@FabienTschanz
Copy link
Contributor

@Kimhal Can you provide a DSC configuration to reproduce the issue?

@Kimhal
Copy link
Author

Kimhal commented May 17, 2024

@FabienTschanz
Copy link
Contributor

FabienTschanz commented May 20, 2024

@Kimhal I don't receive the error you mentioned, but another one ( Invoke-Expression, Missing type name after [ ). Silly question: Are you running the command in an administrative prompt? In my case it then succeeds.

@Kimhal
Copy link
Author

Kimhal commented May 21, 2024

@FabienTschanz I'm running the command in a elevated prompt, but you are right about the error. I'm also is getting the ( Invoke-Expression, Missing type name after [ ) error. And like you it succeeds with generating a report.
But still, there is something wrong with the parser.

@FabienTschanz
Copy link
Contributor

@Kimhal When I run your exact configuration in an elevated prompt, it works without any issues. The parser works as it is supposed to do in that case, unfortunately I am unable to reproduce your issue. No errors can be seen on the console.

Can you try executing the command in an elevated Windows PowerShell (x64) session with Microsoft365DSC version 1.24.515.2 and the exact same configuration you sent? Please make sure to use Uninstall-M365DSCOutdatedDependencies before to get rid of any previous versions laying around.

If there is an error, please post the result of $Error | select *. This shows the errors and where they appeared. Especially useful there is the Exception and the ScriptStackTrace.

@ricmestre
Copy link
Contributor

@FabienTschanz I've also had this issue once I installed 1.24.515.2 (which uses DSCParser v2, the code in question doesn't exist in v1) with my own different blueprints, somehow the error message went away and I cannot explain why.

Nevertheless DSCParser also has other issues, see #4681, which I've already reported to @NikCharlebois

@Kimhal
Copy link
Author

Kimhal commented May 22, 2024

@FabienTschanz I have updated the Microsoft365DSC module and run a Uninstall-M365DSCOutdatedDependencies.
I'm still getting errors, but the report is generated. The @error is attached in a txt file.
error.txt

@ricmestre
Copy link
Contributor

I initially had the error Cannot index into a null array but as explained that went away, nevertheless the error that @Kimhal is reporting now I still have it present with my configuration so there's definitely something going wrong here with the parser.

@FabienTschanz
Copy link
Contributor

@Kimhal Thank you very much for the error log. While searching in there, I discovered that the parser does not find the associated CIM type because it cannot connect to the CIM service. The logged error message is the following:

The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and configure the WinRM service: ""winrm quickconfig"

What happens if you run winrm quickconfig and then try it again? A restart shouldn't be necessary. No idea how it is on a Azure DevOps Pipeline, maybe @ricmestre you know the answer to that.

@ricmestre
Copy link
Contributor

Makes sense since it calls Get-CimClass, regarding the containers in the pipelines they always need WinRM to be enabled whenever I'm performing deployments, since they are ephemeral, nevertheless my unit tests don't initialize it since it was never needed before like it seems to be now.

I'm super busy right now and can't check it but most likely that would solve the problem for me.

@Kimhal
Copy link
Author

Kimhal commented May 23, 2024

thanks guys. That worked for me.😁😁
I am running the Microsoft365dsc version. 1.24.522.1 and DSCParser version 2.0.0.4.

@Kimhal Kimhal closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants