Skip to content

Commit

Permalink
Merge pull request #5591 from FabienTschanz/docs/invalid-operation-error
Browse files Browse the repository at this point in the history
Update documentation for M365DSC updates
  • Loading branch information
NikCharlebois authored Dec 23, 2024
2 parents c206aec + b1acb18 commit b89fcc9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 5 deletions.
9 changes: 4 additions & 5 deletions docs/docs/user-guide/get-started/how-to-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Executing this command can take a minute or two to complete, after which the bas
## Dependencies

However, Microsoft365DSC depends on several other modules to function properly. For example, it uses the <a href="https://www.powershellgallery.com/packages/MSCloudLoginAssistant/">MSCloudLoginAssistant</a> module to delegate all authentication logic to the various workloads, it leverages a dozen <a href="https://www.powershellgallery.com/packages?q=Microsoft.Graph">Microsoft Graph PowerShell modules</a> to interact with various configuration settings, etc. Current versions of Microsoft365DSC no longer download all the required prerequisites by default. When you install the Microsoft365DSC, you only get the core component after which you have to download all prerequisite modules as well. It is our recommendation that you run the following command to update all dependencies on the system after installing the module:
However, Microsoft365DSC depends on several other modules to function properly. For example, it uses the <a href="https://www.powershellgallery.com/packages/MSCloudLoginAssistant/">MSCloudLoginAssistant</a> module to delegate all authentication logic to the various workloads, it leverages a dozen <a href="https://www.powershellgallery.com/packages?q=Microsoft.Graph">Microsoft Graph PowerShell modules</a> to interact with various configuration settings, etc. Current versions of Microsoft365DSC no longer download all the required prerequisites by default. When you install the Microsoft365DSC module, you only get the core component after which you have to download all prerequisite modules as well. It is our recommendation that you run the following command to update all dependencies on the system after installing the module:

```PowerShell
Update-M365DSCDependencies
Expand All @@ -41,11 +41,10 @@ Get-Module Microsoft365DSC -ListAvailable | select ModuleBase, Version

## Updating To A Newer Version

To update an older version of Microsoft365DSC, use the **Update-Module** cmdlet and run the **Update-M365DSCDependencies** cmdlet again to update any dependencies.
To update an older version of Microsoft365DSC, use the **Update-M365DSCModule** cmdlet. This will update the current version of Microsoft365DSC and all dependencies in one go as well as uninstalling all outdated versions.

```PowerShell
Update-Module Microsoft365DSC
Update-M365DSCDependencies
Update-M365DSCModule
```

## More Information
Expand All @@ -55,7 +54,7 @@ More information about installing modules:
- <a href="https://docs.microsoft.com/en-us/powershell/scripting/developer/module/installing-a-powershell-module?view=powershell-7.2" target="_blank">Installing a PowerShell module</a>
- <a href="https://docs.microsoft.com/en-us/powershell/module/powershellget/find-module?view=powershell-7.2" target="_blank">Find-Module cmdlet</a>
- <a href="https://docs.microsoft.com/en-us/powershell/module/powershellget/install-module?view=powershell-7.2" target="_blank">Install-Module cmdlet</a>
- <a href="https://docs.microsoft.com/en-us/powershell/module/powershellget/update-module?view=powershell-7.2" target="_blank">Update-Module cmdlet</a>
- <a href="https://microsoft365dsc.com/user-guide/cmdlets/Update-M365DSCModule/" target="_blank">Update-M365DSCModule cmdlet</a>
- <a href="https://docs.microsoft.com/en-us/powershell/module/powershellget/save-module?view=powershell-7.2" target="_blank">Save-Module cmdlet</a>
- <a href="https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_psmodulepath?view=powershell-7.2" target="_blank">About PSModulePath</a>

25 changes: 25 additions & 0 deletions docs/docs/user-guide/get-started/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,28 @@ Optionally, for improved performance, you can increase the handles and threads p
$quotaConfiguration.HandlesPerHost = 8192
$quotaConfiguration.ThreadsPerHost = 512
```


## Error "InvalidOperation: Cannot index into a null array" when creating a report from configuration

### ISSUE

When creating a report from either running `New-M365DSCDeltaReport` or `New-M365DSCReportFromConfiguration`, you might receive the following error and the generated report is empty:

```powershell
Cannot index into a null array.
At C:\Program Files\WindowsPowerShell\Modules\DSCParser\2.0.0.5\Modules\DSCParser.psm1:**456** char:9
+ $resourceType = $resource.CommandElements[0].Value
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : NullArray
```

### CAUSE

This issue might occur if there are multiple versions of Microsoft365DSC present on the current machine and the configuration contains nested objects.
The nested objects are resolved from their CIM definitions, and if multiple versions of Microsoft365DSC are present, multiple versions of these CIM definitions exist.

### RESOLUTION

Update and install to the latest supported version of Microsoft365DSC using `Update-M365DSCModule`. This will uninstall all outdated versions and dependencies and update to the latest version available on the PowerShell Gallery.

0 comments on commit b89fcc9

Please sign in to comment.